Mr Johnson does it again...thanks Jerry, works nicely. Will
----- Original Message ----- From: "Jerry Johnson" <[EMAIL PROTECTED]> Newsgroups: cf-talk Sent: Friday, May 10, 2002 2:38 PM Subject: Re: Regex problems again... > Just a guess, but... > > Idea 1: > I believe the regex in Cold Fusion is greedy. > > This means it will take the largest chunk of data that matches a particular expressions. > > If this is true, then the part of your expression that follows is going to stretch from the first anchor to the close of the LAST anchor. > > >.*</a> > > You might want to change to > > ><[^>]*></a> > > Idea 2: > escape the quotes with \, just in case. I don;t think you need to, but you might. > > FWIW > Jerry Johnson > > > >>> [EMAIL PROTECTED] 05/10/02 09:22AM >>> > Hi, > > Can anyone advise me with this Regex problem I'm having? I need to convert > all instances of an HTML string into a bracketed number (taking the number > from the URL string pid=n). At the moment, the following is converting the > first instance perfectly.....but no other ones after that, despite me > telling it to! > > Here's the code: > > <CFSET bodytext = REReplaceNoCase(bodytext, "<a > href=""viewphoto.cfm\?pid=([^""]*)"">.*</a>", "[\1]", "ALL")> > > The HTML to strip would look like: > > <a href="viewphoto.cfm?pid=100"><img border=0 > src="imagebin/photolink.gif"></a> > > And this would turn it into [100] > > Any clues why it's not picking up all instances? > > Thanks > > Will > > > > ------- > > Become a Pingographer and share your photos for free: > > http://www.localbounty.com/pingo > > ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

