I think I have a solution, but if a few of you could review and see if it can be any faster or more efficient (or if I'm missing something) I'd appreciate it. To find the end of the URL I'm looking for a single quote, double quote or space.
function extractURLs(inputString) { var nPos=0; var lsURLs = ""; var sDelimiter = chr(9); var nEndPos = ""; var sLink = ""; var sRegExp = "([A-Za-z][A-Za-z0-9+.-]{1,120}:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@&~=-])|%[A-Fa-f0-9]{2}){1,333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@&~=%-]{0,1000}))?)"; if(arrayLen(arguments) eq 2) { sDelimiter = arguments[2]; } nPos = reFindNoCase(sRegExp,inputString); while(nPos) { inputString = mid(inputString,nPos,len(inputString)); nEndPos = reFind("['#chr(34)# ]",inputString); sLink = left(inputString,nEndPos-1); if(NOT listFindNoCase(lsURLs,sLink,sDelimiter)) { lsURLs = listAppend(lsURLs, sLink, sDelimiter); } inputString = mid(inputString,nEndPos,len(inputString)); nPos = reFindNoCase(sRegExp,inputString); } return lsURLs; } Thanks! Dave > Hi, > > RegExp's are not my forte and I need to create a function that will > extract URL's from a body of text and return it in a list. > > I have a function that extracts the anchor tags from a document, but I > need to acurately extract the URL from that anchor tag. I can do a > find for 'href' and so on, but the RIGHT regular expression would make > sure all possibilities are covered like href=", href=' or href= or > href = and so on. > > Can anyone help please? > > Thanks! > Dave ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267322 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4