in reply to Help with regs
The key line invokes URI::Find::Schemeless only for tokens which are plaintext, not part of a tag or other things.my $finder = URI::Find::Schemeless->new(sub { my ($uri, $text) = @_; return qq{<a href="@{[ $uri->abs() ]}">$text</a>}; }); my HTML::TokeParser::Simple->new(\*STDIN); while (my $token = $p->get_token) { my $text = $token->as_is; $finder->(\$text) if $token->is_text; # here's the key print $text; }
Makeshifts last the longest.
|
|---|