s/`(\w+\s+[\w\s]+)`/space_subst($1)/eg;
That gets rid of the backticks, which I think the OPer wants to preserve.
>perl -wMstrict -le "my $s = q{foo `bar baz` quux}; my $t = $s; $t =~ s{ ` (\w+ \s+ [\w\s]+) ` } { (my $r = $1) =~ s{\s}{_}xmsg; $r }xmsge; print $t; $t = $s; $t =~ s{ (` \w+ \s+ [\w\s]+ `) } { (my $r = $1) =~ s{\s}{_}xmsg; $r }xmsge; print $t; " foo bar_baz quux foo `bar_baz` quux
In reply to Re^2: Regexp in mysqldump
by AnomalousMonk
in thread Regexp in mysqldump
by brozzis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |