[Python-bugs-list] [ python-Bugs-800899 ] Making "|" directive from REs a bit clearer

SourceForge.net noreply at sourceforge.net
Fri Sep 5 00:59:49 EDT 2003


Bugs item #800899, was opened at 2003-09-05 08:59
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=800899&group_id=5470

Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Wojtek Walczak (gminick)
Assigned to: Nobody/Anonymous (nobody)
Summary: Making "|" directive from REs a bit clearer

Initial Comment:
Let's take a look, Library Reference, 4.2.1 Regular 

Expression Syntax says:



   "|"

           A|B, where A and B can be arbitrary REs, creates a 

regular

           expression that will match either A or B.

           [...]

!!here_starts_the_darkness!!

           REs separated by "|" are tried from left to right, and 

the

           first one that allows the complete pattern to match 

is considered

           the accepted branch. This means that if A matches, 

B will never

           be tested, even if it would produce a longer overall 

match.

!!here_ends_the_darkness!!



It's not as clear as it can be. For more information take a 

look at: 

<http://mail.python.org/pipermail/python-dev/2003-September/037924.html>



Here's a proposal from Terry Reedy for changing those 

lines from darkness ;-)



"""As the target string is scanned, REs separated by "|" are 

tried from

left to right.  When one pattern completely matches, that 

branch is

accepted.  This means that once A matches, B will not be 

tested

further, even if it would produce a longer overall match."""





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

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



More information about the Python-bugs-list mailing list