Apr 22, 2004, 11:41 AM
Post #3 of 5
True, but that's not the main problem (and not the problem I'm having right now ;).
Re: [jryan] Regex from external app
[In reply to]
How do you get $1 to be interpreted on the substitution side when the whole substitution comes out of a string?
$text="The quick brown fox";
$pat='quick (.*) fox';
$rep='quick fox, who is $1';
($direct = $text) =~ s/quick (.*) fox/quick fox, who is $1/;
($indirect = $text) =~ s/$pat/$rep/;
print "Direct: " . $direct . "\nIndirect: " . $indirect . "\n";
Direct: The quick fox, who is brown
Indirect: The quick fox, who is $1
Can anybody help with that?