each one having a certain value, such as
, so that I can extract, in this case "pleb sauce". However, there are<a href="http://www.poobar.com">pleb sauce</a>
many instances of this name in the page and many different names. What I am hoping to
do is to count all instances of "Pleb sauce", "horsehair underpants" etc.
I found this script on a webpage which looks like it might do what I want:
Code: Select all
#!/usr/bin/perl
use strict;
my $string = "CATINTHEHATWITHABAT"; // just a test
my $regex = '\wAT'; // This needs to be replaced with an array containing
// all the regexs; in this case, could be '\wHA', '\wTH', etc.
my @matches = ();
while ($string =~ /($regex)/gi){
// do stuff here, increment counter etc.
}
run through this loop for each regex?
Thanks!
Paul