mleshin has asked for the wisdom of the Perl Monks concerning the following question:
After parsing a file and extracting the following line-
my $string = "hello $1";
# print $string = 'hello $1
I would like to apply this string as a regexp replacement. For example-
if ("good morning all" =~ /good morning (\w+)/) {
print $string;
# I would like to be written 'hello world add'
}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extracting regex from string
by AnomalousMonk (Archbishop) on Feb 18, 2017 at 05:56 UTC | |
|
Re: Extracting regex from string
by LanX (Saint) on Feb 18, 2017 at 10:28 UTC | |
|
Re: Extracting regex from string
by LanX (Saint) on Feb 18, 2017 at 12:33 UTC | |
by AnomalousMonk (Archbishop) on Feb 19, 2017 at 20:17 UTC | |
|
Re: Extracting regex from string
by BillKSmith (Monsignor) on Feb 18, 2017 at 19:29 UTC |