jakarta-regexp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCallum <gho...@xtra.co.nz>
Subject [Patch] Addition of Clustering (ie non backref'd grouping)
Date Thu, 08 Feb 2001 13:54:41 GMT
Hi all,

I have started using the regexp package because is nice and lightweight but 
found I could not use clustering. I think it might be a Perl extension to re 
but found it was easy to implement in this package.

This allows the use of the following style matching.

(?:\w+(?:\s\w+)+
Mary had a little lamb

This will match with the only paren (0) returning the full string.

A better example is domain names (simplified here not sure if it complies 
with the relevant RFC.)...

([a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*)
www.test.com
jakarta.apache.org

Will both match. with paren 0 having the full string.

Now take the above expression and add the protocol...

(:?\w+://)?([a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*)
http://www.test.com
Paren 0 = http://www.test.com
Paren 1 = www.test.com

Anyway there are about 10 tests in RETest.txt that demostrate this.

regards,
Michael


p.s. I think that I striped a bunch of spaces from the end of lines so there 
are a bunch of extra line in the patch. Not very familiar with using diff :)
Mime
View raw message