Cody Pendant has asked for the wisdom of the Perl Monks concerning the following question:
which worked just fine.$regex = ['foo','bar']; $string = 'blah foo blah'; $string =~ s/$regex->[0]/$regex->[1]/;
But then I wanted to use backreferences:
which didn't. Not even with /e. Is this an old question? It's not in the FAQ.$regex = ['(foo)','bar$1']; $string = 'blah foo blah'; $string =~ s/$regex->[0]/$regex->[1]/;
($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
=~y~b-v~a-z~s; print
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex Substitution, Interpolating on the RHS?
by dave_the_m (Monsignor) on Jul 18, 2005 at 11:52 UTC | |
by Cody Pendant (Prior) on Jul 18, 2005 at 12:04 UTC | |
by diotalevi (Canon) on Jul 18, 2005 at 13:04 UTC | |
|
Re: Regex Substitution, Interpolating on the RHS?
by Roy Johnson (Monsignor) on Jul 18, 2005 at 13:07 UTC | |
by Cody Pendant (Prior) on Jul 18, 2005 at 23:30 UTC | |
by Roy Johnson (Monsignor) on Jul 19, 2005 at 13:20 UTC | |
|
Re: Regex Substitution, Interpolating on the RHS?
by jbrugger (Parson) on Jul 18, 2005 at 11:23 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |