in reply to Regular expression

I see no need for the while loop:
use warnings; use strict; undef $/; my $content = <DATA>; $content =~ s/<span style="font.*/<span style="font-weight: bold;">/gi +; print "$content\n"; __DATA__ <span style="font-weight: bold;color:#000000;"> <span style="font-family:Arial MT;font-size: 25px; font-weight: bold;" +> <span style="color:#000000;" xmlns="http://www.w3.org/1999/xhtml">

prints:

<span style="font-weight: bold;"> <span style="font-weight: bold;"> <span style="color:#000000;" xmlns="http://www.w3.org/1999/xhtml">

See also: