Next / Previous / Contents / Shipman's homepage

5.5. CharsNotIn: Match characters not in a given set

pp.CharsNotIn(notChars, min=1, max=0, exact=0)

A parser of this class matches one or more characters that are not in the notChars argument. You may specify a minimum count of such characters using the min keyword argument, and you may specify a maximum count as the max argument. To create a parser that matches exactly N characters that are not in notChars, use the exact=N keyword argument.

>>> nonDigits = pp.CharsNotIn(pp.nums)
>>> print nonDigits.parseString('zoot86')
>>> fourNonDigits = pp.CharsNotIn(pp.nums, exact=4)
>>> print fourNonDigits.parseString('a$_/#')