summaryrefslogtreecommitdiff
path: root/src/examples/tagCapture.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/tagCapture.py')
-rw-r--r--src/examples/tagCapture.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/examples/tagCapture.py b/src/examples/tagCapture.py
deleted file mode 100644
index e07d518..0000000
--- a/src/examples/tagCapture.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# tagCapture.py
-#
-# Simple demo showing how to match HTML tags
-#
-
-from pyparsing import *
-
-src = "this is test <b> bold <i>text</i> </b> normal text "
-
-def matchingCloseTag(other):
- ret = Forward()
- ret << anyCloseTag.copy()
-
- def setupMatchingClose(tokens):
- opentag = tokens[0]
-
- def mustMatch(tokens):
- if tokens[0][0].strip('<>/') != opentag:
- raise ParseException("",0,"")
-
- ret.setParseAction(mustMatch)
-
- other.addParseAction(setupMatchingClose)
-
- return ret
-
-for m in originalTextFor(anyOpenTag + SkipTo(matchingCloseTag(anyOpenTag),
- include=True,
- failOn=anyOpenTag) ).searchString(src):
- print(m.dump())
-
-for m in originalTextFor(anyOpenTag + SkipTo(matchingCloseTag(anyOpenTag),
- include=True) ).searchString(src):
- print(m.dump())