in reply to Regular Expression Question
Note - this code is very untested.my %regexen = ( v => qr/[aeiou]/i; c => qr/[a-z^aeiou]/i; ); # This is inputted somehow. my $pattern = 'cccv'; my $regex = join '', map { $regexen{$_} } split //, $pattern; # Get @dictionary somehow. foreach my $word (@dictionary) { print "$word matches" if $word =~ /$pattern/; }
------
We are the carpenters and bricklayers of
the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regular Expression Question
by perlguy (Deacon) on Apr 03, 2003 at 20:52 UTC |