in reply to simple regular expression
#!/usr/bin/perl use strict; use warnings; my $text = "start \\chapter{hello}\n end\n"; my $patternreadfromfile = <DATA>; chomp $patternreadfromfile; my $inpattern = qr/\\chapter\{(.*)\}/; eval "\$text =~ s/$inpattern/$patternreadfromfile/g"; print "$text\n"; __DATA__ -- FOUND $1 --
(update: sorry, this node should have been a reply to your other node in this thread, at Re^2: simple regular expression)
|
|---|