chiark / gitweb /
fix regexp not to loop stupidly:
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 9 Sep 2013 11:36:33 +0000 (12:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 9 Sep 2013 11:36:33 +0000 (12:36 +0100)
1. the regexp was too loose and matched /in/ not just /\bin\b/.
2. chiark.peer.fu-berlin.de consists mostly of stopwords by this rule
3. A bug meant that when it got to the end, it didn't stop, but always ate the TLD as if it were a stopword.

cgi

diff --git a/cgi b/cgi
index b9acb9422c5708284063a915cf35f61363654c5b..968745e218940818a98a7b86657802efc62a2d0c 100755 (executable)
--- a/cgi
+++ b/cgi
@@ -203,7 +203,7 @@ foreach my $site (keys %news_sources) {
     my $sk= $site;
     for (;;) {
         last unless $sk =~
-            s/^[^.]*(?:chiark|greenend|news|nntp|peer|feed|in|out)[^.]*\.//;
+  s/^[^. ]*\b(?:chiark|greenend|news|nntp|peer|feed|in|out)\b[^.]*\.//;
         $sk .= " $&";
     }
     foreach my $inout (keys %{ $news_sources{$site} }) {