monkie has asked for the wisdom of the Perl Monks concerning the following question:
I'm looking for a single line Regular Expression solution to the following:
I need to removes all <br> tags between "href='" and the following "'" from a string.
The solution that I have come up with is:
#------------------------ $value = "<a href='\\192.161.254.00\share\Testing\Company ABC\Discover +y <br>Forms\587 <br>Read and Write Gold V8.0.doc' target='_blank' >Fi +le on <br>Cshare</a>"; while ($value =~ m/(href='.*?)<br>(.*?')/gsi) { $value =~ s/(href='.*?)<br>(.*?')/$1$2/gsi; } #------------------------
This seems to be hunky-dorie but I’m sure that there a single line regular expression solution, don’t you?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular Expression Elegance
by massa (Hermit) on Nov 11, 2008 at 13:10 UTC | |
by monkie (Novice) on Nov 11, 2008 at 14:31 UTC | |
|
Re: Regular Expression Elegance
by JadeNB (Chaplain) on Nov 11, 2008 at 15:32 UTC | |
by monkie (Novice) on Nov 11, 2008 at 16:23 UTC | |
by JadeNB (Chaplain) on Nov 11, 2008 at 16:28 UTC | |
by monkie (Novice) on Nov 12, 2008 at 11:25 UTC | |
|
Re: Regular Expression Elegance
by JavaFan (Canon) on Nov 11, 2008 at 13:26 UTC | |
by monkie (Novice) on Nov 11, 2008 at 14:25 UTC | |
|
Re: Regular Expression Elegance
by gone2015 (Deacon) on Nov 11, 2008 at 15:59 UTC | |
by monkie (Novice) on Nov 11, 2008 at 16:07 UTC |