I'm modifying a search script and am trying to get the script to search ALT tags in my webpages. The code I'm using is:
if ($string =~ s/<[^>]*\s+ALT\s*=\s*"(([^>"])*)"[^>]*>/$1/ig)
{
@cut = split(/\">/,$1);
$alt = $cut[0];
for ($i=0;$i<$alt_x;$i++)
{
$string .= $alt;
}
}
Right now, the script only recognizes ALT tags that are capitalized. The script will recognize ALT=Box but not ALT=box. Also, how do I get the script to search the whole alt tag, ie. search "Turtle" and it will find an instance for ALT="box turtle" Any and all info appreciated.
Mike
if ($string =~ s/<[^>]*\s+ALT\s*=\s*"(([^>"])*)"[^>]*>/$1/ig)
{
@cut = split(/\">/,$1);
$alt = $cut[0];
for ($i=0;$i<$alt_x;$i++)
{
$string .= $alt;
}
}
Right now, the script only recognizes ALT tags that are capitalized. The script will recognize ALT=Box but not ALT=box. Also, how do I get the script to search the whole alt tag, ie. search "Turtle" and it will find an instance for ALT="box turtle" Any and all info appreciated.
Mike