in reply to charachter classes, and a misunderstanding...
You want something like:
which says "from the beginning to the ending, are they all not in this class".... if (/^[^yhnujmikolp]+$/i) { ...
This is a common problem when people negate things too much: the negations stack up in the wrong direction. Me, I avoid that kind of regex, and ask for what I want, which will also be faster:
And this finds "aftereffect", as you noted. But with a lot less code, as I'm often prone to do. {grin}@ARGV = qw(/usr/dict/words); my $longest = ""; while (<>) { next unless length > length $longest; # too short next if /[^qwertasdfgzxcvb\n]/i; # wrong hand $longest = $_; } print $longest;
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: charachter classes
by mdillon (Priest) on Aug 21, 2000 at 03:43 UTC |