Re: back references in regexen

P.S.
I have a hard time finding programming or scripting languages which 
don't know backreferences (or couldn't implement them via the PCRE lib).

UNIX Seventh Edition [1]
(thus an early version of the popular stream editor)

   $ echo '="val"' | sed 's/=\(.\)\([^\1]*\)\(\1\)/\2/'
   val
   $

Tobi

[1]
http://museum.sysun.com/museum/u7conn.html
telnet://dino.sysun.com:4004

Tobias Reif wrote:

> Kay, Michael wrote:

[...]
>  > 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 Thursday, 22 May 2003 04:55:55 UTC