> It was not my intention to belittle anyone, and I'm sorry if I came across
> that way. However, I must counter that your claim is incorrect. Fixing the
> negative lookahead syntax will not make it work, as the regex will still
> match from the start of the first table, not the table which contains the
> text being searched for. Also, it will match until the last instance of the
> text being searched for (as a result of incorrectly used greedy repetition).
>
> Here's the regex you proposed, with the missing question mark added:
>
> "<table[^>]*>\s*<tr[^>]*>(?!</tr>).*<td>Code 2</td>"
>
> Essentially, this regex contains only three significant differences from JJ
> Cool's original regex. Yours asserts that:
>
> - The match starts from the first table whose first <tr> isn't empty (i.e.,
> immediately followed by "</tr>").
> - The match cannot make use of any elements between the opening <table> tag
> and the first <tr> tag. (This is a problem since elements such as <caption>,
> <thead>, and <tbody> commonly precede table rows.)
> - The text being searched for ("Code 2") must be the entire contents of a
> <td> element.
That was my interpretation of what he described as the issue...
The lazy operator after the negative lookahead on either </table> or
</tr> are not required in this case because it assumes the tables aren't
nested -- and so it won't match as you say from the start of the first
table. Why? Because there's a </tr> in the first table. The same would
also be true of the negative lookahead for </table>. Since he's only
looking for the start of the table anyway, it doesn't matter that it
will match to the last intance of the text, which is more than likely
only one instance anyway since it's a table column header.
--
s. isaac dealey 512.372.8890
isn't it time for a change?
http://espavo.livejournal.com
http://www.cafepress.com/anupwardspiral
http://people.tribe.net/water_muse/photos
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW
Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1031
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21