Next / Previous / Contents / Shipman's homepage

7.21. stringEnd: Matches the end of the string

The variable pp.stringEnd contains an instance of Section 5.30, “StringEnd: Match the end of the text”.

>>> wordAtEnd = pp.Word(pp.alphas) + pp.stringEnd
>>> print wordAtEnd.parseString("Leicester")
['Leicester']
>>> print wordAtEnd.parseString("West Byfleet")
pyparsing.ParseException: Expected stringEnd (at char 5), (line:1, col:6)