issue2636-08 : Code : Python

lp:~pythonregexp2.7/python/issue2636-08

Created by TimeHorse and last modified

Add support for named POSIX character classes of the form [:class:]. Note, the [] are part of the class definition, and are not in them selves forming a character set. To use a character class it must be included in a character set, e.g. via [[:alphanum:]_], which is equivalent to \w. A character class outside a character set will be interpreted as a non-standard character set and will generate a warning indicating this. Thus, r'[:alpha:]' will match any character in the set([':', 'a', 'h', 'l', 'p']) and generate an error, not [a-zA-Z], as the user might expect. This will be documented. The POSIX and Perl-specific Character Classes are:

alpha -- [A-Za-z]
alnum -- [A-Za-z0-9]
ascii -- All valid printable characters in the ASCII set
blank -- [ \t]
cntrl -- Control Character, [\x00-\x1f\x7f]
digit -- \d
graph -- alphanum + punct (below)
lower -- [a-z]
print -- graph + space (below)
punct -- Any punctuation, e.g. ',', '.', '!', etc.
space -- \s + '\x0b', [\s\x0b]
upper -- [A-Z]
word -- \w (specific to Python / Perl, not part of POSIX)
xdigit -- [0-9a-fA-F]

Note: The Unicode equivalents will be added to each character class where applicable.

Get this branch:
bzr branch lp:~pythonregexp2.7/python/issue2636-08

Branch merges

Related bugs

Related blueprints

Branch information

Recent revisions

39031. By Jeffrey C. "The TimeHorse" Jacobs <email address hidden>
39030. By Jeffrey C. "The TimeHorse" Jacobs <email address hidden>
39029. By Jeffrey C. "The TimeHorse" Jacobs <email address hidden>
39028. By Jeffrey C. "The TimeHorse" Jacobs <email address hidden>
39027. By Jeffrey C. "The TimeHorse" Jacobs <email address hidden>
39026. By Jeffrey C. Jacobs <email address hidden>
39025. By Jeffrey C. Jacobs <email address hidden>
39024. By Jeffrey C. Jacobs <email address hidden>
39023. By Jeffrey C. Jacobs <email address hidden>
39022. By Jeffrey C. Jacobs <email address hidden>

Branch metadata

Branch format:
Branch format 6
Repository format:
Bazaar pack repository format 1 with rich root (needs bzr 1.0)