The substitution operator s has the form: |
$line =~ s/regex1/regex2/ ; |
As with m, the operator s can use any delimiter and so |
$line =~ s#regex1#regex2# ; |
is an equivalent form |
In the substitution s/regex1/regex2/g the /g causes substitution to occur at all possible places in string (normally only the first match is found) |
Note that /i and /g can be used together |
In an HTML doc, replace 2x2 with <NOBR>2 x 2 </NOBR> |
Search: (\d+)x(\d+) |
Replace: <NOBR>\1 x \2</NOBR> |
PERL: s|(\d+)x(\d+)|<NOBR>\1 x \2</NOBR>|i |