Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
How would I create a regular expression to delete everything before the first <tr> and after the last </tr>? Esentially I want to crop out all the HTML except the Table part. After processing the above variable should look like:<title>stuff</title> <br>Header</br> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>3</td> <td>4</td> </tr> <br>Trailing Info
<tr> <td>1</td> <td>2</td> </tr> <tr> <td>3</td> <td>4</td> </tr>
$var =~ s/^.*<tr>//mg; $var =~ s/<\/tr>.*$//mg;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Removing leading and ending text?
by McDarren (Abbot) on Jan 29, 2006 at 04:49 UTC | |
|
Re: Removing leading and ending text?
by wfsp (Abbot) on Jan 29, 2006 at 09:25 UTC | |
|
Re: Removing leading and ending text?
by talexb (Chancellor) on Jan 29, 2006 at 04:47 UTC | |
|
Re: Removing leading and ending text?
by smokemachine (Hermit) on Jan 29, 2006 at 07:40 UTC |