in reply to Removing text between HTML tags
The substitution below works for the sample provided, however this is the wrong way to do it, I've assumed that this is very simple HTML with nothing that would break a very simple minded substitution. (eg, what would happen when a button with the alternative text "Next >" )
There is a famous response to this on another site, but the Perl specific response is to use a HTML parsing module eg HTML::TokeParser::Simple which helpfully has extracting the content from a html file as the first example.
s/<[^>]+>//g;
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Removing text between HTML tags
by perll (Novice) on Sep 14, 2014 at 15:03 UTC | |
by Utilitarian (Vicar) on Sep 14, 2014 at 15:48 UTC | |
by sundialsvc4 (Abbot) on Sep 15, 2014 at 00:23 UTC | |
by perll (Novice) on Sep 23, 2014 at 09:34 UTC |
In Section
Seekers of Perl Wisdom