in reply to Extracting regex from string
Please see How do I post a question effectively?
The better the question the better the answers!
I need to guess what you really want:
my $input = "good morning all"; my $pattern = qr/good morning (\w+)/; my $replace = '"hello $1"'; my $output = $input =~ s/$pattern/$replace/ree; print $output;
hello all
Please be sure to have full control of the $replace strings since the eval /ee would lead to security issues.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
|
|---|