J
Jason Carlton
I'm using URI::Find to convert addresses to links, like so:
$finder = URI::Find -> new(
sub {
($uri, $orig_uri) = @_;
return "<a href='$uri'>orig_uri</a>";
}
);
$finder -> find(\$text);
Is there a way to make this ignore images, so that it doesn't create:
<img src="<a href="http://www.whatever.com/image.jpg">http://
www.whatever.com/image.jpg</a>">
The images on my server will have several different path
possibilities, so there's nothing constant inside of $uri to scan for.
I thought about letting it do this, then manually manipulating $text,
but there has to be a better way! Something like:
while ($text =~ /(<img[^>]+?>)/sgxi) {
$mod_text = $1;
$mod_text =~ s/<a href="//gi;
$mod_text =~ s/<\/a>//gi;
}
I haven't tried that, but it seems like it would work, although it
leaves a LOT of room for error.
TIA,
Jason
$finder = URI::Find -> new(
sub {
($uri, $orig_uri) = @_;
return "<a href='$uri'>orig_uri</a>";
}
);
$finder -> find(\$text);
Is there a way to make this ignore images, so that it doesn't create:
<img src="<a href="http://www.whatever.com/image.jpg">http://
www.whatever.com/image.jpg</a>">
The images on my server will have several different path
possibilities, so there's nothing constant inside of $uri to scan for.
I thought about letting it do this, then manually manipulating $text,
but there has to be a better way! Something like:
while ($text =~ /(<img[^>]+?>)/sgxi) {
$mod_text = $1;
$mod_text =~ s/<a href="//gi;
$mod_text =~ s/<\/a>//gi;
}
I haven't tried that, but it seems like it would work, although it
leaves a LOT of room for error.
TIA,
Jason