|
Regexp::IgnoreTextCharacteristicsHTML - Let us ignore the HTML tags when parsing HTML text |
Regexp::IgnoreTextCharacteristicsHTML - Let us ignore the HTML tags when parsing HTML text
use Regexp::IgnoreTextCharacteristicsHTML;
my $rei =
new Regexp::IgnoreTextCharacteristicsHTML($text,
"<!-- __INDEX__ -->");
# split the wanted text from the unwanted text
$rei->split();
# use substitution function
$rei->s('(var)_(\d+)', '$2$1', 'gi');
$rei->s('(\d+):(\d+)', '$2:$1');
# merge back to get the resulted text my $changed_text = $rei->merge();
Inherit from Regexp:Ignore and implements the get_tokens method. The tokens that are returned by the get_tokens as unwanted are text characteristics HTML tags. To be specific, the tags: <B>, <BASEFONT>, <BIG>, <BLINK>, <CITE>, <CODE>, <EM>, <FONT>, <I>, <KBD>, <PLAINTEXT>, <S>, <SMALL>, <STRIKE>, <STRONG>, <SUB>, <SUP>, <TT>, <U>, <VAR>, <A>, <SPAN>, and <WBR>.
It will also take as unwanted tokens any HTML remarks and any remarks that MSWord creates when saving a document as HTML. However this behaviour can be changed using the class members IGNORE_HTML_REMARKS and IGNORE_WORD_REMARKS.
("B", "FONT")
The tags that will be sent to this method, will not be ignored by the object.
Rani Pinchuk, <rani@cpan.org>
Copyright (c) 2002 Ockham Technology N.V. & Rani Pinchuk. All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
the perl manpage, the perlop manpage, the perlre manpage, the Regexp::Ignore manpage.
|
Regexp::IgnoreTextCharacteristicsHTML - Let us ignore the HTML tags when parsing HTML text |