> the reason I'm looking for these <img...>
> tags, is because they are not XHTML compliant and I needed to fix that
> so that I could get this HTML fragment into an acceptable XML mode.

So, why are you worrying about the tables if it's the image tags that
are the issue?

Just replace <img([^>]*[^/])> with <img\1/> and not worry about the tables?


I believe there are some XPath processors that can handle non-XML
HTML, but only because I've read a couple of references to such -
couldn't give any examples/recommendations.


> With a great deal of trial and error I finally came up with this.
> <td align="center">.*?(?=<img).*?</td>

Well, with a known set of source data that's fine, but potentially
that could match <td align="center">[stuff]</td><td><img/></td>

That's why the more general solution needs the negative lookahead for
/td> - to make sure that any img found is still within the opening
table cell.
The non-greedy matching (.*?) is not smart enough to do that for you.

Hope this all helps. :)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1172
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