Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Regex (lookahead) Confusion

by QM (Parson)
on Feb 05, 2004 at 23:12 UTC ( [id://326930]=note: print w/replies, xml ) Need Help??


in reply to Re: Regex (lookahead) Confusion
in thread Regex (lookahead) Confusion

Bart's regex does the trick. I was thinking of a lazy approach using sort - slower, but easier for the regex neophytes to get a handle on:
#!/your/perl/here use warnings; use strict; while (<DATA>) { chomp; my $sort = join '', sort split ''; ( ( $sort =~ /^[afhmstw]+$/ ) # only these chars and ( $sort !~ /([afhmstw])\1/ ) ) # no repeats ? print "<$_> OK\n" : print "<$_> Not OK\n"; } __DATA__ smsa smta stmwhas BADsmtaEXAMPLE __END__ <smsa> Not OK <smta> OK <stmwhas> Not OK <> Not OK <BADsmtaEXAMPLE> Not OK

-QM
--
Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://326930]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-18 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found