> "<(table)[^>]*>(?:(?:<\1[^>]*>.*?</\1>|.)(?!</\1>))*?Code 2"
>
> It now supports from zero to one level of nesting (this logic can easily
> be extended to support more levels, if necessary), and will match from the
> start of the outermost table which contains "Code 2", even if the text
> appears in a nested table.

This is just a follow-up to note that my description of the regex above is
incorrect. I meant to say it will match from the innermost table containing
"Code 2".

Note that it also supports, e.g., nested tables not containing "Code 2"
appearing before "Code 2" in a table which contains it. E.g., with...

<table>
        <tr>
                <td>
                        <table><tr><td>Code 1</td></tr></table>
                </td>
                <td>Code 2</td>
        </tr>
</table>

It would match from the first <table> tag until the "2". Hence, it would
correctly match from the beginning of the innermost table containing "Code
2" (the nested table doesn't contain it).





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1030
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21

Reply via email to