[:alnum:] is defined as

Alphanumeric characters: ‘[:alpha:]’ *and* ‘[:digit:]’; in the ‘C’ locale
and ASCII character encoding, this is the same as ‘[0-9A-Za-z]’.



AND = need to satisfy *BOTH* alpha and digit

OR = need to satisfy *EITHER* alpha or digit





It looks like ‘[:alpha:]’ *AND* ‘[:digit:]’ functions as ‘[:alpha:]’ *OR* ‘
[:digit:]’, See example





Example:

# cat /tmp/c

adc

x1y1z123

456



# grep [[:alpha:]] /tmp/c

adc

x1y1z123



# grep [[:digit:]] /tmp/c

x1y1z123

456



# grep [[:alnum:]] /tmp/c

adc

x1y1z123

456





### if [:alnum] functions as ‘[:alpha:]’ *AND* ‘[:digit:]’, it should show
x1y1z123 only

Reply via email to