Wow... pretty complicated... thanks, Bobby! Rick
> -----Original Message----- > From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] > Sent: Friday, October 12, 2007 12:22 PM > To: CF-Talk > Subject: RE: How to write this regex? > > I'm sure there is probably a better way... such as a simple regex.. > youll > need Doom for that one but until then try this... > > <cfsavecontent variable="txt"> > This is a test of something <a href="test.cfm" title="test">And this is > a > link</a><br /> > This is another test but with an image tag <img src="somimg.jpg" al"" > /> so > let's see how it goes > </cfsavecontent> > > <cfscript> > function noBreak(str) > { > blockArr = arrayNew(1); > while (reFindNoCase("<.*?", str) and reFindNoCase("<.*?", str)) > { > startPos = reFindNoCase("<.*?", str); > endPos = reFindNoCase("<*.?>", str); > > thisBlock = Mid(str, startPos, endPos - startPos+2); > str = removeChars(str, startPos, endPos - startPos+2); > > ArrayAppend(blockArr, thisBlock); > str = Insert("[!*#ArrayLen(blockArr)#*!]", str, startPos - > 1); > } > > str = replace(str, ' ', ' ', 'all'); > > for (i=1; i lte ArrayLen(blockArr); i=i+1) > { > str = replacenocase(str, '[!*#i#*!]', blockArr[i]); > } > > return str; > } > </cfscript> > > > <cfoutput>#noBreak(txt)#</cfoutput> > > ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. > Bobby Hartsfield > http://acoderslife.com > > -----Original Message----- > From: Rick Faircloth [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 11, 2007 9:01 PM > To: CF-Talk > Subject: How to write this regex? > > Hi, all. > > I thought I could figure this out, but apparently not. at least so far. > > But how would I write a regex that would find all spaces and change > them to > except those inside a < or > ? > > REreplace(string, "all spaces not in between < and >", " ", "All") > And > I'd rather not have an "unbreakable" space, but I couldn't come up with > anything else to use. > > (I gave it a shot Claude!) > > Suggestions anyone? > > Rick > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:290964 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

