From: Bill Kelly Date: 2004-11-11T10:12:14+09:00 Subject: Re: A Wiki/Spam Report From: "Jim Weirich" > > (3) Detecting the addition of links is difficult because the change is > submitted to the wiki as a whole page, with nothing to distinguish the new > material from the old. To determine that we would have to run a diff > algorithm between the old and new content. How about: ... er... my Perl is very rusty... I concur with the ... :) ..uh..um... my $old = "abc http://blah.com def ftp://foo.bar ghi"; my $new = "abc http://spam1.com def ftp://foo.bar ghi http://spam2.com"; my %old_links; $old_links{$&}++ while $old =~ m{\w+://[^\s)>]+}g; my $new_links; while($new =~ m{\w+://[^\s)>]+}g) { $new_links++ unless defined $old_links{$&}; } print "new links: $new_links\n"; ...The above doesn't count negatively when links disappear, only positively when new links appear... I'd first written this version: my %delta; $delta{$&} -= 1 while $old =~ m{\w+://[^\s)>]+}g; $delta{$&} += 1 while $new =~ m{\w+://[^\s)>]+}g; my $d; foreach my $val (values %delta) { $d += $val; } print "delta links: $d\n"; ...But I'd guess the former is probably more like what we'd want to count. HTH, Regards, Bill