On 09/11/07 15:39:54, Stuart Guthrie 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 %$#@

A crude but effective method is to delete one only instance of each 
regex and then compare the string lengths. For example,

#!/bin/bash

EXPRESSION0="ABCDefgh1234%$#@"
EXPRESSION1=`echo "$EXPRESSION0" | sed '
        s/[A-Za-z]//
        s/[0-9]//
        s/[EMAIL PROTECTED]//'`

echo "${#EXPRESSION0}"
echo "${#EXPRESSION1}"

HTH,
Robert Thorsby

Where a computer like the ENIAC is equipped with 18,000
vacuum tubes and weighs 30 tons, computers in the future
may have only 1,000 vacuum tubes and weigh only 1 1/2 tons.
                -- Popular Mechanics, March 1949

--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to