in reply to regex question
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/; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: regex question
by gnu@perl (Pilgrim) on Sep 24, 2002 at 17:54 UTC |