[Patches] [ python-Patches-572936 ] (?(id/name)yes|no) re implementation

noreply@sourceforge.net noreply@sourceforge.net
Mon, 01 Jul 2002 11:09:46 -0700


Patches item #572936, was opened at 2002-06-24 03:41
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=572936&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Gustavo Niemeyer (niemeyer)
>Assigned to: Fredrik Lundh (effbot)
Summary: (?(id/name)yes|no) re implementation

Initial Comment:
This patch implements a regular expression feature, which allows   
some interesting patterns, in the same way as implemented in perl.   
For example, (?(1)yes|no) matches with "yes" if group "1" exists, and   
with "no", if it doesn't. Without this feature, the regular expression   
must be duplicated to get the same results. In addition to perl's 
feature, it will also accept a Python named group as argument. 
   
Here's an example:   
   
(<)?\w+@\w+(\.\w+)+(?(1)>)   
  
This is a poor email matching regular expression, which will match   
with or without the "<>" symbols.   
   

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=572936&group_id=5470