How do I get the output I want, which is "FOUND hello", not "FOUND $1". Advice appreciated. regards, /iaw/usr/bin/perl -w use strict; my $text= "start \\chapter{hello}\n end\n"; my $inpattern = qr/\\chapter\{(.*)\}/; my $outpattern = " -- FOUND \$1 -- "; $text =~ s/$inpattern/$outpattern/ge; print "$text\n";
In reply to simple regular expression by iaw4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |