Next / Previous / Contents / Shipman's homepage

5.4. CaselessLiteral: Case-insensitive string match

pp.CaselessLiteral(matchString)

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')
['Ni']
>>> print ni.parseString('NI')
['Ni']
>>> print ni.parseString('nI')
['Ni']
>>> print ni.parseString('ni')
['Ni']