values(" GOVALUE, 0.074997, 0.103143, 0.153955, 0.260586", " 0.068394, 0.082183, 0.110329, 0.161142, 0.267773", " 0.081887, 0.095677, 0.123822, 0.174635, 0.281266", " 0.111534, 0.125324, 0.153470, 0.204282, 0.310914", " 0.165731, 0.179521, 0.207666, 0.258479, 0.365110") #### #!c:/perl/bin -w $text = qq ( abc(" 0.123511, 0.074997, 0.103143, 0.153955, 0.260586",\ " 0.068394, 0.082183, 0.110329, 0.161142, 0.267773",\ " 0.081887, 0.095677, 0.123822, 0.174635, 0.281266",\ " 0.111534, 0.125324, 0.153470, 0.204282, 0.310914",\ " 0.165731, 0.179521, 0.207666, 0.258479, 0.365110") ); $text =~ s/abc(\D+)([\d\.\-]*)(.*)/values$1GOVALUE$3/g; print "$text\n"; #### $text2 = 'foo|abc-./|foo '; # $text2 =~ s%(foo|\w+)([//.-]+)(.*)%$1 :i: $2 :i: $3%g; # output is: ++foo|abc :i: -./ :i: |foo ++ # captures the hyphen, dot and slash in $2 with ONLY the fwd_slash escaped # and capturs "|foo " in $3 # $text2 =~ s%([\w|]+)([.-]+)(.*)%__$1_:_$2_:_$3__ : second variation%g; # output is: ++__foo|abc_:_-._:_/|foo __ : second variation++ # hyphen, dot still captured in $2 with no escaping at all inside the class $text2 =~ s%([\w|]+)([.-]+/)(.*)%$1:$2:$3 : third variation%g; # output is: ++foo|abc:-./:|foo : third variation++ # Moved the fw_slash (unescaped, using % as delimiters) into the second capture # expression... and fw_slash turns up correctly in $2 print "\t++$text2++\n";