summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2016-10-06 06:45:03 +0000
committerPaul McGuire <ptmcg@austin.rr.com>2016-10-06 06:45:03 +0000
commit277884c3ee70307bb6ab234fb7c3286517cac65a (patch)
tree4bcb6f3d6a9115d7dcc54c0ad0eab64443ada9f2
parentfc34811821d7697c7bf2134cf50e5caa4ffdcec5 (diff)
downloadpyparsing-git-277884c3ee70307bb6ab234fb7c3286517cac65a.tar.gz
Add example to LineStart docstring
-rw-r--r--src/pyparsing.py19
1 files changed, 19 insertions, 0 deletions
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__()