in reply to Regexp help!!
use strict; use warnings; my $a=' $text=~s#Find \#Text#Replace Text#; $text=~s/Find \/Text/Replace Text/; $text=~s{Find \}Text}{Replace Text}; '; if ($a =~ / # start \$text=~s # remember to escape the $ to avoid interpolation (.) # capture the '#' (.*?) # match any non-newline character non-greedily (?<!\\) # make sure the '#' is not escaped in your data \1 # the first unescaped '#' (.*?) # match any non-newline character non-greedily \1; # the second '#' /x # end ) { # need value $findtext='Find \#Text'; print "$2\n"; # need value $repltext='Replace Text'; print "$3\n" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regexp help!!
by Roy Johnson (Monsignor) on Oct 21, 2005 at 14:02 UTC |