Don't search titles with regexes.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Wed, 5 Oct 2005 01:16:06 +0000 (01:16 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Wed, 5 Oct 2005 01:16:06 +0000 (01:16 +0000)
git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@353 959494ce-11ee-0310-bf91-de5d638817bd

ANN.pm

diff --git a/ANN.pm b/ANN.pm
index b2c3db3..1406c45 100644 (file)
--- a/ANN.pm
+++ b/ANN.pm
@@ -57,7 +57,12 @@ sub getlist
     # The only way to recognize entries that seems sure is to look
     # after the "HOVERLINE" class.
     
-    push @ret, $1 while $html =~ /<A\s.*CLASS=HOVERLINE\s.*>.*<FONT.*>([^<>]*$name[^<>]*)<\/FONT/ig;
+    while($html =~ /<A\s.*CLASS=HOVERLINE\s.*HREF=\"([^\"]+)\".*>([^<]+)<\//ig) {
+       if((substr "" . lc $2 , 0, length $name) eq lc $name) {
+           push @ret, $2;
+       }
+    }
+    # push @ret, $1 while $html =~ /<A\s.*CLASS=HOVERLINE\s.*>.*<FONT.*>([^<>]*$name[^<>]*)<\/FONT/ig;
     
     return @ret;
 }
@@ -76,9 +81,13 @@ sub getid
     # The only way to recognize entries that seems sure is to look
     # after the "HOVERLINE" class.
     
-    (($url) = ($html =~ /<A\s.*CLASS=HOVERLINE\s.*HREF=\"([^\"]+)\".*$name/i)) || return;
+    while($html =~ /<A\s.*CLASS=HOVERLINE\s.*HREF=\"([^\"]+)\".*>([^<]+)<\//ig) {
+       if((substr "" . lc $2 , 0, length $name) eq lc $name) {
+           return ($1 =~ /id=(\d+)$/)[0];
+       }
+    }
     
-    return ($url =~ /\?id=(\d+)$/)[0];
+    return undef;
 }
 
 sub geturl