back toc next

Atoms

Atoms are the basic components of a RE

x the character 'x' itself
\X if X is an 'a', 'b', 'f', 'n', 'r', 't', or 'v', then the ANSI-C interpretation of \x. Otherwise, a literal 'X' (used to escape operators such as '*')
\123 the character with octal value 123
\xe5 the character with hexadecimal value e5
. any character (byte) except newline
[xyz] a "character class": x OR y OR z
[ako-sP] a "character class" with a range in it; matches an 'a', a 'k', any letter from 'k' through 's', or a 'P'
[^A-Z] a "negated character class": i.e., any character but those in the class. In our example, any character EXCEPT an uppercase letter
[:str:] a "character class expression": Allowed only within another character class. The valid contents of str are: alnum, alpha, blank, cntrl, digit, graph, lower, print, punct, space, upper, xdigit