Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I must be missing something obvious here. I want to grab the text between the strings <blockquote> and </blockquote> so I tried this ...
The output is simply ...$ cat test.pl #!/usr/bin/perl my $data; while(<DATA>) { $data .= $_; } my $stuff = "uninit"; if ( $data =~ /<blockquote>(.*)<\/blockquote>/m ) { $stuff = $1; } print "$stuff\n"; __DATA__ </p> <blockquote>This is a non-fiction collection of Maugham's observations + of life in Asia in the early 20th Century. (Summary by BellonaTimes) </blockquote> <!-- if div.cd-cover --><div class="cd-cover"> </div><!-- end if -->
... I was hoping for ...uninit
... what am I doing wrong here?This is a non-fiction collection of Maugham's observations of life in +Asia in the early 20th Century. (Summary by BellonaTimes)
Thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Isn't /m for multiline regex?
by jwkrahn (Abbot) on Apr 19, 2010 at 04:52 UTC | |
Re: Isn't /m for multiline regex?
by PeterPeiGuo (Hermit) on Apr 19, 2010 at 04:32 UTC | |
Re: Isn't /m for multiline regex?
by afoken (Chancellor) on Apr 19, 2010 at 11:39 UTC | |
by ww (Archbishop) on Apr 19, 2010 at 12:45 UTC | |
by GertMT (Hermit) on Apr 20, 2010 at 07:18 UTC |
Back to
Seekers of Perl Wisdom