Thanks everyone for some great help. I thought there might be a couple of regex gurus out there!
Stuart On Nov 9, 2007 5:42 PM, Roger Barnes <[EMAIL PROTECTED]> wrote: > > Not being a regex expert I was hoping someone could point me > > at a list, forum or just give me a pointer on how to achieve this: > > > > Field that must have 2 out of 3 of these: > > > > standard a-z/A-Z > > arabic numbers 0-9 > > special chars %$#@ > > Is there a constraint requiring that this be done with a single regex? > Depending on the context, there might be a number of more suitable > programmatic approaches. > > For example, an unfinished, untested, inefficient, slapped together > bash/grep approach might look like this, without getting tangled in > regex syntax... > > password='a1#' > hitcount=0 > if $( echo "$password" | grep -q "[A-Za-z]" ); then echo "Got alpha"; > let "hitcount = $hitcount + 1"; fi > # Repeat for numeric and special chars > # Check $hitcount == 2 or $hitcount >= 2, depending on your requirements > > - Rog > > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > -- Best regards Stuart Guthrie Director Polonious Pty Ltd (w) http://www.polonious.com.au (m) 0403 470 123 Polonious Support Numbers: Sydney: 61-2-9007-9842 Chicago: 1-312-212-3952 This above all: to thine ownself be true, And it must follow, as the night the day, Thou canst not then be false to any man. -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
