in reply to Simple regex to remove all but a list of words
If you still want to use a regex, it might work like this:
# with regex: my $regex = join '|', @good_words; if (param('evil') =~ m/\A(?:$re)\z/){ print "good param\n"; } # with a hash: my %whitelist; @whitelist{@good_words} = (1) x @good_words; if ($whitelist{param('evil')}){ print "good param\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Simple regex to remove all but a list of words
by FunkyMonk (Bishop) on Jun 04, 2008 at 21:53 UTC | |
by moritz (Cardinal) on Jun 04, 2008 at 22:16 UTC |