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 ;) > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Get Instant Hacker Protection, Virus Detection, Antispam & Personal Firewall. http://www.houseoffusion.com/banners/view.cfm?bannerid=62 Message: http://www.houseoffusion.com/lists.cfm/link=i:21:817 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
