On Mar 21, 2010, at 10:38 AM, Warren Michelsen wrote:
> Another grep question: How do I find, using grep, the third column within a
> selected table?
>
> I want to delete the third column in its entirety. The opening <td> and
> closing </td> may be on different lines. So, I need to find and select each
> instance of <td>SomeTextAcrossMultipleLines</td> provided each such
> occurrence is the third such occurrence following a <tr>.
Warren,
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 of luck,
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.