Beaker has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to turn HTML into BBCode where there is a matching end tag. The following regex is not doing anything:
$text =~ s~<font color=("|')?((\w|\s)+)("|')?>(.*?)<\/font>~\[color=$2\]$5\[/color\]~ig;Sample input:
<font color="blue"><i><b> <br>Some text</font>, <br>an aP.S. I know the HTML is deprecated, it's legacy code and I haven't the time to work out how to re-parse all the content (of which there is a lot!).
Thanks for any help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex not working
by hippo (Archbishop) on Jul 17, 2015 at 15:26 UTC | |
by Anonymous Monk on Jul 17, 2015 at 18:01 UTC | |
|
Re: Regex not working
by Monk::Thomas (Friar) on Jul 17, 2015 at 19:15 UTC | |
|
Re: Regex not working
by codiac (Beadle) on Jul 18, 2015 at 05:09 UTC | |
|
Re: Regex not working
by tangent (Parson) on Jul 18, 2015 at 00:32 UTC | |
|
Re: Regex not working
by GotToBTru (Prior) on Jul 17, 2015 at 15:47 UTC | |
by Beaker (Beadle) on Jul 17, 2015 at 16:08 UTC | |
by Beaker (Beadle) on Jul 17, 2015 at 16:10 UTC | |
by FreeBeerReekingMonk (Deacon) on Jul 17, 2015 at 17:59 UTC | |
by Beaker (Beadle) on Jul 17, 2015 at 19:24 UTC | |
by stevieb (Canon) on Jul 17, 2015 at 17:58 UTC | |
by Beaker (Beadle) on Jul 17, 2015 at 19:24 UTC |