Entries tagged with ‘Regular expressions’

XHTMLParagraphFormat() Version 3

Version 3 of the previously posted XHTMLParagraphFormat() ColdFusion function has just been released. Thanks to visitor and commenter Christopher Lewis for drawing my attention to a minor bug. Get it while it’s hot: Download XHTMLParagraphFormat() Version 3 I’d love to hear if you end up using this function or if you have any suggestions, fixes, […]

XHTMLParagraphFormat Version 2

UPDATE (Oct 23, 2006): This version of XHTMLParagraphFormat() is out of date. If you wish, you should check out the latest version. Unfortunately, I found a major error in the previously posted XHTMLParagraphFormat() function that caused it to not work properly under many circumstances. However, after doing some more research and testing, I banged out […]


UPDATE (Oct 23, 2006): This version of XHTMLParagraphFormat() is out of date. If you wish, you should check out the latest version. While reworking the athletics site, I realized that it was time to improve our less than perfect method for displaying news stories as HTML. The first obvious solution for formatting a chunk of […]

Regular Expression to find HTML links with title attributes

I recently needed to write a regular expression to find HTML and XHTML links with title attributes (<a href="http://www.gustavus.edu" title="Visit the Gustavus Adolphus College homepage">Gustavus</a>). Here it is: <a[[:print:]]*title=('|"")?(.*?(?=1))1?[[:print:]]*>([[:print:]]*)</a> Note that the [[:print:]] parts are applicable to ColdFusion regular expressions and would have to be changed to something else if you aren’t using ColdFusion. Additionally, […]

Updated Regular Expression for E-Mail

We discovered a small bug in our old regular expression for checking valid e-mail addresses. When a user tried to use an address with capital letters on a form, it failed to match the regular expression. We updated the regular expression to account for capital letters anywhere in the e-mail address. ^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*.(([a-zA-Z]{2,3})|([Aa][Ee][Rr][Oo]|[Aa][Rr][Pp][Aa]|[Cc][Oo][Oo][Pp]|[Ii][Nn][Ff][Oo]|[Mm][Uu][Ss][Ee][Uu][Mm]|[Nn][Aa][Mm][Ee]))$ This new expression […]

Adblock list

The adblock extension for Firefox allows users to block unwanted advertisements from webpages. This provides for a much faster, cleaner, and enjoyable browsing experience. However, to block those unwanted ads, you have to add filters to your adblock plugin. One could either go through all of the websites that one visits and add filters for […]

HTML tag regular expression

We found this regular expression online at haacked.com for finding html tags in a string. I used this in the new Gustavus eCard program that I have been working on (stay tuned) as a way to get the text of captions which contain hyperlinks. This regular expression was written by Phil Haack. </?w+(((s|n)+w+((s|n)*=(s|n)*(?:".*?"|'.*?'|[^'">s]+))?)+(s|n)*|(s|n)*)/?> This expression […]

Regular expression for e-mail

Regular expressions can be very useful and efficient if used properly. For a while now in some of our applications we have been using the following regular expression to check e-mail addresses for proper formatting. ^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*.(([a-z]{2,3})|(aero|coop|info|museum|name))$ This will ensure that the user has entered a properly formatted e-mail address such as user@domain.com.