Next / Previous / Contents / Shipman's homepage

5.4. CaselessLiteral: Case-insensitive string match


The argument is a literal string to be matched. The resulting parser matches that string, except that it treats uppercase and lowercase characters the same.

The matched value will always have the same case as the matchString argument, not the case of the matched text.

>>> ni=pp.CaselessLiteral('Ni')
>>> print ni.parseString('Ni')
>>> print ni.parseString('NI')
>>> print ni.parseString('nI')
>>> print ni.parseString('ni')