This one time, at band camp, Alexander Samad wrote: >Hi > > >a friend has to implement in regex something along these lines of these >rules to match against a string (password) > >Must match 3 out of 4 rules > >1) Contain 1 or more Uppercase char >2) Contain 1 or more Lowercase char >3) Contain 1 or more numeric >4) Contain 1 or more punctuation
Firstly, you can't count in a regex, so you can't say "once 3 of these match, then succeed." So really you want to test for each of these (with or without a regex) and then sum the results. You didn't say what language, so man perlre for some common regex syntax, and the re module from http://www.python.org/doc/lib/ for some python documentation. I can think of a python solution with about 6 lines in it, but I'd hate to deprive you of the joy of learning. Have fun! -- [EMAIL PROTECTED] http://spacepants.org/jaq.gpg -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
