Regular expression allow you to use Bracket Expression to represent the set of collating elements. The syntax for
Bracket Expression is
[...], where you can place in
... any of collating elements, collating symbols, equivalence classes, character classes, or range expressions.
The one you use
alpha is a character class name, made by place class name between
:]. So, you have used the character class expression
[:alpha:] in between
The character class expression is not the same as range expression
[a-zA-Z] in some locales. Here's the best example you can see:
$ LC_ALL=en_US.utf8 bash -c 'case b in [A-Z]) echo yes; esac'
while using character class gave you nothing:
$ LC_ALL=en_US.utf8 bash -c 'case b in [[:upper:]]) echo yes; esac'
^, if place at the beginning of
Bracket Expression will negate the match of expression.
[^[:alpha:]] will match any characters, which don't belong to
[:alpha:] characters class:
$ case 1 in [^[:alpha:]]) echo yes;; esac