Character classes and Internationalization
Of course ranges were originally meant to be ASCII ranges, so that [ -%] stands for [ !"#$%] and [a-z] stands for "any lowercase letter". Some Unix implementations generalized this so that a range X-Y stands for the set of characters with code between the codes for X and for Y. However, this requires the user to know the character coding in use on the local system, and moreover, is not convenient if the collating sequence for the local alphabet differs from the ordering of the character codes. Therefore, POSIX extended the bracket notation greatly, both for wildcard patterns and for regular expressions. In the above we saw three types of items that can occur in a bracket expression: namely (i) the negation, (ii) explicit single characters, and (iii) ranges. POSIX specifies ranges in an internationally more useful way and adds three more types:
(iii) Ranges X-Y comprise all characters that fall between X and Y (inclusive) in the currect collating sequence as defined by the LC_COLLATE category in the current locale.
(iv) Named character classes, like
[:alnum:] [:alpha:] [:blank:] [:cntrl:]
[:digit:] [:graph:] [:lower:] [:print:]
[:punct:] [:space:] [:upper:] [:xdigit:]
so that one can say [[:lower:]] instead of [a-z], and have things work in Denmark, too, where there are three letters past z in the alphabet. These character classes are defined by the LC_CTYPE category in the current locale.
(v) Collating symbols, like [.ch.] or [.a-acute.], where the string between [. and .] is a collating element defined for the current locale. Note that this may be a multi-character element.
(vi) Equivalence class expressions, like [=a=], where the string between [= and =] is any collating element from its equivalence class, as defined for the current locale. For example, [[=a=]] might be equivalent to [a????] (warning: Latin-1 here), that is, to [a[.a-acute.][.a-grave.][.a-umlaut.][.a-circumflex.]].
sh(1), glob(3), fnmatch(3), locale(7), regex(7)