----- Original Message ----- From: "Wallick, Mike" <[EMAIL PROTECTED]> Hey all. I'm trying to cook up a regexp to search a block of text for links. What I'm looking for is something like:
<a href="path with spaces/file with spaces.htm"> I want to read the block of text and replace spaces with %20 so links won't break. ------------------------------- Try this: <cfloop condition="REFindNoCase('(<a href=""[^ ]+) ([^""]*"")', content)"> <cfset content=REReplaceNoCase(content, '(<a href="[^ ]+) ([^"]*")', '\1%20\2', 'ALL')> </cfloop> I don't know why you have to loop around until they're all replaced - I thought setting the scope of REReplaceNoCase to 'ALL' would do that. Well, this is where *my* knowledge of regexps falls over! Maybe someone else can clear this up? Anyway, the regexp itself seems to work. A plain English translation: Match <a href=", followed by one or more characters that aren't spaces, followed by a space, followed by zero or more characters that aren't quote marks, followed by a quote mark. Didn't think it was worth matching to the end of the <a> tag, this should be far enough. I'm sure the back references are clear enough. HTH, - Gyrus ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://www.norlonto.net - PGP key available ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists