From cb19493f8d747d4546f3adb92f78effc993428f9 Mon Sep 17 00:00:00 2001 From: ptmcg Date: Thu, 6 Oct 2016 06:45:03 +0000 Subject: Add example to LineStart docstring git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/trunk@448 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b --- src/pyparsing.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/pyparsing.py b/src/pyparsing.py index c809956..e9842ab 100644 --- a/src/pyparsing.py +++ b/src/pyparsing.py @@ -3089,6 +3089,25 @@ class GoToColumn(_PositionToken): class LineStart(_PositionToken): """ Matches if current position is at the beginning of a line within the parse string + + Example:: + + test = """\ + AAA this line + AAA and this line + + AAA but not this one + + B AAA and definitely not this one + """ + + for t in (LineStart() + 'AAA' + restOfLine).searchString(test): + print(t) + + Prints:: + ['AAA', ' this line'] + ['AAA', ' and this line'] + """ def __init__( self ): super(LineStart,self).__init__() -- cgit v1.2.1