> 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