473,511 Members | 10,041 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regular expressions: recursive patterns and callouts

Hi!
I think two extensions to re could be really powerful in aiding to
match non regular strings -for example those containing parens nested
up to an arbitrary depth- but without a significative performance loss,
although I'm not at all sure at this last point. One of these features
is re nesting; I don't mean nesting some strings and then compiling the
composed re, but to include -possibly recursive- references to other
re's. The second feature is the ability to add callout points in a re,
so external functions would be called when the matcher reaches those
points to validate the current matched prefix or even to do some
arbitrary further matching of its own, advancing the pattern position.
pcre implements similar features with its (?CN) callout and (?N)
recursive patterns mechanisms.
Are the above or equivalent features planned for future python
releases?
Do you know of some extension package which provide them or at least
pcre compatible res?
Thank you in advance,
Carlos

Jan 21 '06 #1
1 1956
"Carlos" <ca************@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi!
I think two extensions to re could be really powerful in aiding to
match non regular strings -for example those containing parens nested
up to an arbitrary depth- but without a significative performance loss,
although I'm not at all sure at this last point. One of these features
is re nesting; I don't mean nesting some strings and then compiling the
composed re, but to include -possibly recursive- references to other
re's. The second feature is the ability to add callout points in a re,
so external functions would be called when the matcher reaches those
points to validate the current matched prefix or even to do some
arbitrary further matching of its own, advancing the pattern position.
pcre implements similar features with its (?CN) callout and (?N)
recursive patterns mechanisms.
Are the above or equivalent features planned for future python
releases?
Do you know of some extension package which provide them or at least
pcre compatible res?
Thank you in advance,
Carlos


Pyparsing supports both parse-time callouts (called "parse actions") and
recursive grammar definitions.

Download pyparsing at http://pyparsing.sourceforge.net.

-- Paul
Jan 22 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1910
by: Magnus Lie Hetland | last post by:
Hi! I've been looking at ways of dealing with nested structures in regexps (becuase I figured that would be faster than the Python parsing code I've currently got) and came across a few...
1
4155
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
4
4821
by: lucky | last post by:
hi there!! i'm looking for a code snipett wich help me to search some words into a particular string and replace with a perticular word. i got a huge data string in which searching traditional...
6
2722
by: Sébastien Boisgérault | last post by:
Hi, I'm searching for a POSIX 1003.2 compatible regular expression engine. The Python binding "pregex" by Neal Becker may do the job, but I did not manage to download it as the original link...
25
5130
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
0
1939
by: peridian | last post by:
Hi, I wanted a web page where I could post code to, and have it appear in coloured formatting based on the context of the code. Most of the techniques I have seen for this involve complex use...
13
7458
by: Wiseman | last post by:
I'm kind of disappointed with the re regular expressions module. In particular, the lack of support for recursion ( (?R) or (?n) ) is a major drawback to me. There are so many great things that can...
12
2438
by: FAQEditor | last post by:
Anybody have any URL's to tutorials and/or references for Regular Expressions? The four I have so far are: http://docs.sun.com/source/816-6408-10/regexp.htm...
0
7251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7089
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.