J
John Burgess
Hi,
I am having some trouble with regexps and hope someone can help.
Problem: Iterating through a list of newsgroups and matching only those
with 2 .'s in the name. So comp.lang.perl would match but comp.lang or
comp.lang.perl.misc would not.
(Broken) Solution: I have got something like this
$test = "comp.lang.perl";
if ($test =~ m/([^\.]\.[^\.]){2}/g) {print STDERR "$test is 2\n";} else
{print STDERR "$test is not 2\n";}
Clearly this doesn't work. I can't see what I'm doing wrong. Tips
appreciated.
John
I am having some trouble with regexps and hope someone can help.
Problem: Iterating through a list of newsgroups and matching only those
with 2 .'s in the name. So comp.lang.perl would match but comp.lang or
comp.lang.perl.misc would not.
(Broken) Solution: I have got something like this
$test = "comp.lang.perl";
if ($test =~ m/([^\.]\.[^\.]){2}/g) {print STDERR "$test is 2\n";} else
{print STDERR "$test is not 2\n";}
Clearly this doesn't work. I can't see what I'm doing wrong. Tips
appreciated.
John