issue2636-08 : Code : Python (original) (raw)

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

Created byTimeHorse on 2008-04-28 and last modifiedon 2008-09-24

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 branchlp:~pythonregexp2.7/python/issue2636-08

Branch merges

Branch information

Recent revisions

39031. ByJeffrey C. "The TimeHorse" Jacobs on 2008-09-21

39030. ByJeffrey C. "The TimeHorse" Jacobs on 2008-06-18

39029. ByJeffrey C. "The TimeHorse" Jacobs on 2008-06-11

39028. ByJeffrey C. "The TimeHorse" Jacobs on 2008-06-09

39027. ByJeffrey C. "The TimeHorse" Jacobs on 2008-05-24

39026. ByJeffrey C. Jacobs on 2008-04-28

39025. ByJeffrey C. Jacobs on 2008-04-27

39024. ByJeffrey C. Jacobs on 2008-04-27

39023. ByJeffrey C. Jacobs on 2008-04-26

39022. ByJeffrey C. Jacobs on 2008-04-25

Branch metadata

Branch format:

Branch format 6

Repository format:

Bazaar pack repository format 1 with rich root (needs bzr 1.0)