in reply to Matching regular expression over multiple lines
#!/usr/bin/perl -l # http://perlmonks.org/?node_id=1201392 use strict; use warnings; local $/ = '<footer>'; open my $fh, '<', \<<END; <blockquote> <p><b>Joos van Cleve</b> - Lucretia (detail)</p> </blockquote> <p>beautiful</p> </blockquote> <p>indeed I am</p> <footer><a href END while(<$fh>) { /^(.*)\n.*<footer>/m and print $1 =~ s/<.*?>//gr; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Matching regular expression over multiple lines
by Maire (Scribe) on Oct 16, 2017 at 05:47 UTC |