- or download this
$data =~ s{(<a\s(?:[^>](?!href))*href\s*)(&(&[^;]+;)?(?:.(?!\3))+(?:\3
+)?)([^>]+>)}
{$1.decode_entities($2).$4}gsei;
- or download this
<p class="foo" name="bar">
<p name="bar" CLASS="ovid has no class">
<p NAME="bar" class="ovid has no class">
<p name="bar" class="ovid has no class">
- or download this
package HTML::Token;
...
return $tag;
}
}
- or download this
my $html = <<END_HTML;
<h1>This is a test</h1>
...
push @tokens => HTML::Token->new($token);
}
push @tokens => (qw[* . *]); # make the (p) tag zero or more, followed
+ by anything
- or download this
use Token::Regex;
my $regex = Token::Regex->new('HTML::Token');
$regex->parse(\@tokens);
- or download this
my $tokens = html_tokens(<<END_HTML);
<h1>This is html</h1>
...
}
return \@tokens;
}