Peter Boughton wrote:
> Just replace <img([^>]*[^/])> with <img\1/> and not worry about the tables?
>   
The main reason is that the fix I'm using is to remove the images, since 
they are irrelevant and unavailable to this conversion exercise.  I 
could make them compliant and ignore them.  But since this is more a 
learning exercise then anything, I wanted to see if I could match the 
entire <td...> block and remove it, since without the <img...> tag the 
cells would be empty.

> 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. :)
>   

It did, but could somebody parse the regex syntax for me in plain 
English.  I can say I could only understand about half of it on sight.
<td[^>]*>(?:[^/]|/(?!td>))*<img[^>].*?</td>

The main features I do not grok is the what role the [^>] plays and how 
to interpret this part in front of the negative look behind; ?:[^/]/



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:1173
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