in reply to Re^2: Reg exps?
in thread Reg exps?
--->Updated to fix regex - thx JavaFanuse strict; use warnings; my $my_name="Acidovorax JS42"; my $db_name="Acidovorax sp. JS42"; my @names = split " ", $my_name; my $numel = @names; #number of words to match my $count; foreach (@names) { if ($db_name=~/^|\s\Q$_\E$|\s/) { $count++; #count matches } } print "MATCH" if $count==$numel; #report match if all words match
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Reg exps?
by JavaFan (Canon) on Jan 14, 2010 at 19:06 UTC | |
by fod (Friar) on Jan 14, 2010 at 22:31 UTC |