Infinite Loop or Just taking too long ?

"Kumar, Vasanth" <[email protected]> Tue, 25 Feb 2003 16:56:21 -0500
Newsgroups gmane.comp.jakarta.oro.user
Message-ID <F500BDA6D2EAD311AD5B00508BCF2DF304CB1A49@iwexchange1.na.interworld.com>
Hi,

We use ORO in our application for to provide regular expression capability.  One of our users had created an email validation expression as follows:
^[A-Za-z0-9#_!'\(\)\-]+([A-Za-z0-9#_!'\(\)\.\-]+)*@[A-Za-z0-9#_!'\(\)\-]+[\.]+([AZa-z0-9#_!'\(\)\.\-]+)+$

As you can see, this is inefficient and can be simplified to (at least) the following:
^[A-Za-z0-9#_!'\(\)\-]+[A-Za-z0-9#_!'\(\)\.\-]*@[A-Za-z0-9#_!'\(\)\-]+[\.]+[AZa-z0-9#_!'\(\)\.\-]+$

However, the original expression seems to hang ORO when given a long, invalid, email.
(Though I must admit I don't know whether it is hanging or just taking a really long time.)

An example of an email that seems to slow it down/hang is:
abcdefghijklmnopqrstuvwxyz1234567890@yahoo.

Note that valid emails are evaluated successfully (i.e. [email protected] doesn't hang ORO).

I am enclosing my test case as well.

This seems to be an issue in the latest version - 2.0.7.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]