Hi,
I would like to define a parser to detect strings containing repeated terms :
- it should match 'A123A', 'B123B'
- but not 'A123B'
With python re module, I would define a parser like this :
parser = re.compile(r'(\w+)(\d+)\1')
Is there a pyparsing equivalent to re \1 and \2 patterns in pyparsing ?
--
Loïc
Check out matchPreviousExpr and matchPreviousLiteral methods.
-- Paul
-----Original Message-----
From: Loïc Berthe [mailto:lo...@li...]
Sent: Thursday, January 30, 2014 3:56 PM
To: pyp...@li...
Subject: [Pyparsing] Pyparsing equivalent to regex \1, \2 ... patterns
Hi,
I would like to define a parser to detect strings containing repeated terms
:
- it should match 'A123A', 'B123B'
- but not 'A123B'
With python re module, I would define a parser like this :
parser = re.compile(r'(\w+)(\d+)\1')
Is there a pyparsing equivalent to re \1 and \2 patterns in pyparsing ?
--
Loïc
----------------------------------------------------------------------------
--
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends. Skip the complicated setup - simply import a
virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg..clktrk
_______________________________________________
Pyparsing-users mailing list
Pyp...@li...
https://lists.sourceforge.net/lists/listinfo/pyparsing-users
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com