Tag: html
-
Regular Expression to find HTML links with title attributes
—
by
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,…
-
HTML tag regular expression
—
by
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…