in reply to Re^2: Reg exp questions
in thread Reg exp questions
Quoting is in M$Win style:
C:\>perl -E "my $str='abc()[]xyz'; $str =~ s/[()\[\]]{1}/\"/g; say $st +r; abc""""xyz
IOW, use a character class and escaping; both of which can be found in perldoc's perlre* pages. Note that the quantifier is redundant here, but could be useful were you trying to substitute two-at-a-time. OTOH, the /g modifier is NOT optional for this use case.
C:\>perl -E "my $str='a)bc([]xyz'; $str =~ s/[()\[\]]{2}/\"/g; say $st +r; a)bc"]xyz
|
|---|