Based on the correction you've described above, what you're really looking for is way to say "match the whole word". You can do that by specifying boundaries (note, this is untested):
You can read more about \b in perlre.$words = "\b(directory|file|age|action)\b"; # A little more Perl-ish: while (<>) { print "Couldn't find $_\n" unless /$words/; }
In reply to Re: regex question
by VSarkiss
in thread regex question
by gnu@perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |