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