Ah, I knew I was missing something. ....but... you can prevent that with a negative lookahead. :) Something along the lines of. <Emphasis type="([a-z])[^"]+">([^<]|<(?!Emphasis))+?</Emphasis> So it only matches Emphasis tags that do not themselves contain the <Emphasis string. That should work, right? (inside an appropriate cfloop)
On 11/14/06, Rob Wilkerson <[EMAIL PROTECTED]> wrote: > On 11/14/06, Peter Boughton <[EMAIL PROTECTED]> wrote: > > But wouldn't a non-greedy match only ever find the closest closing > > tag, and if we can assume valid XML, that will always be the correct > > one? > > It will always find the closest end tag, but that may not be the right > one in a nested scenario. If the poster were looking at > <b><i>foo</i></b> then it would work because the tags are different, > but by way of an analogy, the tags in question are structured as > <Emphasis type="bold"><Emphasis > type="italic">foo</Emphasis></Emphasis>. Given that structure > (meaning the same-ness of the tags), the non-greedy match for the bold > tag would return the end tag for italics. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:990 Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21
