How to match a newline \n in a perl regex?

I want to match this line,

<center>'''<font color="blue"><font size="18.0pt">No Change Alarms Help &amp; Information</font></font>'''</center>

and replace it with,

=<center>'''<font color="blue">No Change Alarms Help &amp; Information</font>'''</center>=

Now it would be simple if the tags were always font colour or center, but they can be absolutely anything and there can be multiple of them.

My current code is this:

$html =~ s/<font size=".+">(.+)<\/font>/$1/g;

but this obviously does not do the = on each end.

What I would like to do is this:

$html =~ s/\n(.+)<font size=".+">(.+)<\/font>(.+)\n/=$1$2$3=/g;

However it fails to match the newline characters and I cannot figure out how to make it match them, any clues?

(I'm converting html to wiki markup, however the converter stuffs up the font sizes so I'm manually converting them to wiki style headings.)

6
задан Sam 3 September 2014 в 18:42
поделиться