Say I have the following in perl:
my $string; $string =~ s/ /\\\\ /g; $string =~ s/\'/\\\\\'/g; $string =~ s/`/\\\\`/g;
Can the above substitut
$string =~ s/([ '`])/\\$1/g;
Uses a character class [ '`] to match one of space, ' or ` and uses brackets () to remember the matched character. $1 is then used to include the remembered character in the replacement.
[ '`]
()
$1