Subject: bug#15410: [:alnum:] is not [:alpha:] AND [:digit:]... [:alnum:] is [:alpha:] OR [:digit:]

From: Nick Aganan <[email-masked]>
Date: Wed, 18 Sep 2013 12:07:00 -0400

[: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