You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-dev@jakarta.apache.org by Michael McCallum <gh...@xtra.co.nz> on 2001/02/08 14:54:41 UTC
[Patch] Addition of Clustering (ie non backref'd grouping)
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 :)
Re: [Patch] Addition of Clustering (ie non backref'd grouping)
Posted by Michael McCallum <mi...@spinsoftware.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 9 Feb 2001, at 11:55, Jon Stevens wrote:
> on 2/8/01 5:54 AM, "Michael McCallum" <gh...@xtra.co.nz> wrote:
>
> > Anyway there are about 10 tests in RETest.txt that demostrate this.
> >
> > regards,
> > Michael
>
> Q: There are two tests that don't pass. Why?
Good question. Possible I made the patch and then made a change it was 3 in the morning I will check it out when I am home next.
> #159
> #161
>
> Q: 89,90c89,90
> < //new RETest(arg);
> < test();
> ---
> > new RETest(arg);
> > //test();
>
> Why?
This was because test(); does not test of the command line parameters so could not use
interative tests or pass the file I wished RETest to use as a parameter. Its possible something
had changed that i missed between the 1.2 source and the cvs repository.
Michael
p.s. I will have a look later today to see whats going on with both of those and send another
patch.
-----BEGIN PGP SIGNATURE-----
Version: N/A
iQA/AwUBOoVHKrPjWznw9K1HEQKajACgmy4cZAE73lEMZ9wSRlhXhA1UVNsAoKsT
qyDNCPyVrJKEmJsv/BnAdPiO
=PS0U
-----END PGP SIGNATURE-----
--- BEGIN GEEK CODE BLOCK ---
Version 3.12
GCS d+(-) s:- a-- C++(+++)$ UL++++(H)(S)$ P+++$ L+++$>++++
E--- W++ N++ o++ K? !w() O? !M V? PS+ PE+++ Y+ t+ 5++ X++
R(+) !tv b++(++++) D++ G>++ e++> h--()(*) r+ y+()
--- END GEEK CODE BLOCK ---
Re: [Patch] Addition of Clustering (ie non backref'd grouping)
Posted by Jon Stevens <jo...@latchkey.com>.
Hi Michael,
your patch is now in CVS.
thanks,
-jon
Re: [Patch] Addition of Clustering (ie non backref'd grouping)
Posted by Michael McCallum <gh...@xtra.co.nz>.
Hi.
Jon Stevens > Q: There are two tests that don't pass. Why?
Having got home and looked at the tests I think I did not answer the question
properly earlier. I assume you mean why should these not match?
Jon Stevens > #159
If so then #159 the www is preceded by a period.
The re requires that the the first character of the domain name be
alpanumeric or a hyphen.
http://.www.test.com
Jon Stevens > #161
The re only matchs ftp and http protocols. But not Fttp.
NOTE: The "Match: NO" means a successful non-matching.
A big...
*********************************************
************Failure*************************
*********************************************
type message appears if one of the tests "fails".
As to the test(); as opposed to new RETest( args );
I have included another patch to clean this up( this is a repeat of the
previous patch with additions).
I think someone intended to clean it up earlier but did not finish or was
distracted as the javadocs says one thing and the code does something other.
I think it on track now...
Michael
Re: [Patch] Addition of Clustering (ie non backref'd grouping)
Posted by Jon Stevens <jo...@latchkey.com>.
on 2/8/01 5:54 AM, "Michael McCallum" <gh...@xtra.co.nz> wrote:
> Anyway there are about 10 tests in RETest.txt that demostrate this.
>
> regards,
> Michael
Q: There are two tests that don't pass. Why?
#159
#161
Q: 89,90c89,90
< //new RETest(arg);
< test();
---
> new RETest(arg);
> //test();
Why?
-jon
--
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
<http://jakarta.apache.org/velocity/> && <http://java.apache.org/turbine/>
Re: [Patch] Addition of Clustering (ie non backref'd grouping)
Posted by Jon Stevens <jo...@latchkey.com>.
on 2/8/01 5:54 AM, "Michael McCallum" <gh...@xtra.co.nz> wrote:
> 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.
Thanks, I will take a look at it today.
-jon
--
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
<http://jakarta.apache.org/velocity/> && <http://java.apache.org/turbine/>