in reply to Search and replace
Use the substitution operator s///g like this:
1:30 >perl -wE "my $found = 'ENV{\"VCINSTALLDIR\"}\ATLMFC\LIB\amd64;E +NV{\"LIBPATH\"}'; $found =~ s/ENV{\"(.*?)\"}/\$ENV(\"$1\")/g; say $fo +und;" $ENV("VCINSTALLDIR")\ATLMFC\LIB\amd64;$ENV("LIBPATH") 1:30 >
Within the substitution, the parentheses capture the “value” text which is used in the replacement as $1. The /g modifier tells the regex engine to keep searching and substituting until the string is exhausted.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search and replace
by Bharath666 (Novice) on Jan 31, 2013 at 15:53 UTC | |
by Bharath666 (Novice) on Jan 31, 2013 at 15:59 UTC | |
by Athanasius (Cardinal) on Jan 31, 2013 at 16:23 UTC | |
by Bharath666 (Novice) on Feb 01, 2013 at 05:57 UTC |