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):

$words = "\b(directory|file|age|action)\b"; # A little more Perl-ish: while (<>) { print "Couldn't find $_\n" unless /$words/; }
You can read more about \b in perlre.

Replies are listed 'Best First'.
Re: Re: regex question
by gnu@perl (Pilgrim) on Sep 24, 2002 at 17:54 UTC
    Hey, I like that. Using /^$words$/ works, but this is more precise. I'll try it out. Hang on......................yup, it works.

    Thanks again to all.