You lost a < here.my $text = '1 + 2 <br> <maths> + dfdf</maths>'; my $output = ""; while ($text =~ m/((<maths>.*?<\/maths>)|([^<]*))/gs) { if ($2) { $output .= $2; } else { my $segment = $3; $segment =~ s/+/ + /g; $output .= $segment; } } print $output . "\n"; __END__ 1  +  2 br> <maths> + dfdf</maths>
In reply to Re^3: Regular Expression Doubt
by Anonymous Monk
in thread Regular Expression Doubt
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |