On Mar 21, 2010, at 10:21 AM, Warren Michelsen wrote:

> I need to search using grep to find...
> 
> A pair of <td></td> tags across multiple lines
> 
> between which is an anchor <a> </a> which can contain any text and which may 
> also be across multiple lines.
> 
> I can find parts of what I want but have been unable to put together the 
> parts to find the whole.


SEARCH : (<tr[^>]*>)((<td[^>]*>[^<]+</td>[\s]*){2,2})(<td[^>]*>[^<]+</td>)
REPLACE : \1\2

(<tr[^>]*>)
((<td[^>]*>[^<]+</td>[\s]*){2,2})
(<td[^>]*>[^<]+</td>)

line 4 traps for either :
        <tr>
        <tr class="pred">

lines 5, traps for any combination : 
        <td> ... </td><td> ... </td>
        <td> ... </td><td class="pblue"> ... </td>

        <td class="pblue"> ... </td><td class="pblue"> ... </td>
        <td class="pblue"> ... </td><td> ... </td>
        
This example has five columns, but you could have more (not valid html)

<tr><td> column 1 </td> 
<td> and column 2 </td><td> and 
column 3
</td><td> and column 4</td><td> column 5</td>
</tr>
<tr class="pred"><td class="pblue"> column 1 </td><td> column 2 </td><td> and 
column 3
and more</td><td> column 4</td><td> column 5</td>
</tr>
<tr><td> column 1</td><td>and column 2</td><td> and 
column 3
and more</td><td class="pblue"> and 
column
4 and 
more</td><td> column 5</td>
</tr>

Will yield this (all column 3's are gone):

<tr><td> column 1 </td> 
<td> and column 2 </td><td> and column 4</td><td> column 5</td>
</tr>
<tr class="pred"><td class="pblue"> column 1 </td><td> column 2 </td><td> 
column 4</td><td> column 5</td>
</tr>
<tr><td> column 1</td><td>and column 2</td><td> and 
column
4 and 
more</td><td> column 5</td>
</tr>

Best Regards,

Bill Hernandez
Plano, Texas

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.

To unsubscribe from this group, send email to 
bbedit+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to