I totally missed that he'd included that. So I solved the problem with.... that. I'm just going to fall back on my original statement about having too much blood in my caffeine stream. :-)
--Ben Pascal Peters wrote: > Ben, although I agree with you on non-greedy matches, Axel (a colleague > of mine btw) was correct: it will match your example. > > </[^p] was in the group and will match </a > > It wasn't complete, because it won't match <p><pre>test</pre></p>, but > this can be fixed by adding </p[^>] in the group. > > Pascal > > >>-----Original Message----- >>From: Ben Doom [mailto:[EMAIL PROTECTED] >>Sent: 12 January 2005 16:02 >>To: RegEx >>Subject: Re: Any character, any character at all. >> >>Except the <[^/] prevents it from matching this: >> >><p><a>link</a></p> >> >>Off the top of my head, I think it would work if you used this > > instead: > >></[^p] >> >>Just to be nitpicky, it was impossible to do a non-greedy match. What >>you are doing approximates one, but it isn't really the same thing. >> >>take all that with a grain of salt -- I'm still getting the first dose >>of caffiene into my system. >> >>--Ben >> >>Axel Glorieux wrote: >> >>>>>If you want to only grab the first paragraph you need to set the > > regex > >>to be >> >>>>>"not greedy". It escapes me how to do that in CFMX (which uses > > Java > >>>>>RegExes), but unfortunately this just couldn't be done in CF before > > MX. > >>> >>> >>>Thats not quite true, it's just a bit trickier. >>> >>>str = "<p><b>hello</b></p><p>goodbye</p>" >>> >>>RE = "<p[^>]*>([^<]|<[^/]|</[^p])+</p>" >>> >>>Using this you can loop to REFindNoCase every <p> tag in a string >> >>provided that they're not nested. This should work with CF5. >> >>>This is for those poor souls who for some reason must stick to a > > version > >>prior to MX ;) >> >>> >>> >>> >>> >>> >>> >>> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:21:819 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
