WG15 Defect Report Ref: 9945-2-88
Topic: BRE's


This is an approved interpretation of 9945-2:1993.

.

Last update: 1997-05-20


								9945-2-88

 _____________________________________________________________________________

	Topic:			BRE's
	Relevant Sections:	2.8.3.3


Defect Report:
-----------------------

	Date: Fri, 18 Nov 1994 15:25:42 -0800
	From: Fred Zlotnick <[email protected]>


I would like to request an official, binding interpretation from the
WG15 concerning the following point in ISO/IEC 9945-2:1993 (POSIX.2).

In the description of backreferences in Basic Regular Expressions
(BREs) in POSIX.2, subclause 2.8.3.3 states (in part):

	The backreference expression \n shall match the same
	(possibly empty) string of characters as was matched by a
	subexpression enclosed between \( and \) preceding the n.

My question revolves around the use of the phrase "(possibly empty)".
In particular, consider the following BRE:

	a\(b\)*c\1

Does this BRE match the string "ac"?

The BRE "a\(b\)*c" clearly matches "ac".  In this case, \(b\) fails to
match, but \(b\)* matches zero or more instances of 'b' (and therefore
matches anything).  Adding the backreference requires that the
backreference match what the subexpression matched (which was
nothing).  One can read the standard as meaning that this is an empty
match, and that therefore the backreference will (in this case) match
an empty string.  Alternatively, one can read the standard as saying
that the backreference fails to match because the subexpression it
references failed to match.

Which of these interpretations is correct?

Thank you for your attention to this matter.

WG15 response for 9945-2:1993
-----------------------------------

This request is substantially identical to interpretation #43 part 15, and 
the resolution to that interpretation applies in this case.

 
Rationale 
--------
None.


Response received: Feb 10 1995
Proposed resolution Re-forwarded: Aug 11 1995
Finalized: Sept 12 1995