Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: REgular expression to check the string that allows "a","b" and "c" to occur only once in any order.

by oha (Friar)
on Dec 11, 2007 at 10:12 UTC ( #656363=note: print w/replies, xml ) Need Help??


in reply to REgular expression to check the string that allows "a","b" and "c" to occur only once in any order.

print "ok!\n" unless /([abc]).*\1/;
the RE above checks if one of [abc] is repeated

if you want to declare "abcz" wrong too, just:

print "ok!\n" unless /(([abc]).*\2|[^abc])/;
which also check if a bad char is present.

Oha

  • Comment on Re: REgular expression to check the string that allows "a","b" and "c" to occur only once in any order.
  • Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2022-01-24 16:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (64 votes). Check out past polls.

    Notices?