Filewatcher File Search File Search
Content Search
» » » » » otp_src_R12B-2.tar.gz » Content »
pkg://otp_src_R12B-2.tar.gz:41190987/otp_src_R12B-2/lib/common_test/priv/rx-1.5/rgx-tests/backrefs/  info  downloads


The backref test checks for conformance to the Posix left-most longest

The rule says that regexec must find the leftmost and longest match.
Consistant with that, each subexpression must also be the leftmost
possible match, giving precedence to lower numbered subexpressions.

Here is an example:

	pattern: (abcd|abc)(d|)
	text:    abcd

The pattern can only match "abcd" and must match the text.  The question
is how the pmatch data is set.  Is it:

   [A]	\1 = "abcd"
	\2 = ""


   [B]	\1 = "abc"
	\2 = "d"

Note that option [A] has assigned \1 the leftmost and longest of its
possible matches while [B] has assigned \2 the leftmost and longest of
its possible matches.  

The correct answer is [A] since subexpression \1 is the lower numbered
subexpression, and therefore making \1 leftmost-longest has precedence
over making \2 leftmost-longest.
Results 1 - 1 of 1
Help - FTP Sites List - Software Dir.
Search over 15 billion files
© 1997-2017