in reply to Re: regex question
in thread regex question

Thanks for pointing it out. I did mis-state my problem. I only want to match if $_ is an exact match for the alternate. I only want to match on 'directory', not 'directorys' or 'directoryy' or 'cheeze whiz'.

Replies are listed 'Best First'.
Re^3: regex question
by Aristotle (Chancellor) on Sep 24, 2002 at 17:46 UTC
    Use \b to assert a word boundary then. my $word = qr/\b(directory|file|age|action)\b/; Or ^ and $ to assert string start/end (respectively). my $word = qr/^(directory|file|age|action)$/; Or any combination of the two that you like. See perldoc perlre.

    Makeshifts last the longest.