Getting the link from A tags /Getting all the links from a string in ColdFusion

Posted by: scoopseven 15 years ago

I thought for sure that this would be something fairly easy to find. Alas, it was not. I did find a way to get all of the text from between the a tag, but not the links.  Here's how you do it:
<cfset beginlink = REFindNoCase("https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?", myText)> <cfset endlink = findnocase('"', myText, beginlink)> <cfset linklen = endlink - beginlink> <cfset mylink = mid(myText, beginlink, linklen)>
Obviously, you can optimize this into a couple of lines, but there it is.

Currently unrated


Recent Tweets

Recent Posts

Archive

2013
2012
2011
2010
2009
2008
2007
2006

Categories

Authors

Feeds

RSS / Atom