Re: back references in regexen

Kay, Michael wrote:

 > I agree this can be a handy feature, but I don't think we want to
 > diverge from the XML Schema regular expression syntax except for
 > facilities that require more than boolean matching.

Perhaps the WXS spec will one day include this feature.

 > The other consideration is that we want
 > to stick to a core subset of features that are widely available in
 > existing regular expression libraries, to make life livable for
 > implementors.

Ruby has backreferences in regexen [1], also Perl [2], Python [3], and 
Java [4]. If a modern language (eg XSLT 2, WXS, etc) doesn't currently 
have this feature, then it should implement it IMHO.

The PCRE lib [6] provides this feature [7] for C++ etc; it can be used 
to implement regexen in many languages and apps.

Tobi

[1] last example on
http://www.rubycentral.com/book/tut_stdtypes.html#UJ

[2]
http://www.perl.com/doc/manual/html/pod/perlre.html

[3] item "\number"
http://www.python.org/doc/current/lib/re-syntax.html

[4] item "Back references"
http://java.sun.com/j2se/1.4.1/docs/api/java/util/regex/Pattern.html
also
http://java.sun.com/docs/books/tutorial/extra/regex/groups.html#backref

[5]
http://www.php.net/manual/en/pcre.pattern.syntax.php#regexp.reference.back-references

[6]
http://www.pcre.org/

[7] item "BACK REFERENCES"
http://www.pcre.org/pcre.txt

more:

.NET
http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconbackreferenceconstructs.asp

-- 
http://www.pinkjuice.com/

Received on Wednesday, 21 May 2003 13:45:24 UTC