RE: Bad character class exception on pattern that works for JDK's Pattern class

"Reuben Sivan" <[email protected]> Wed, 11 Oct 2006 09:36:36 -0400
Newsgroups gmane.comp.jakarta.regexp.user
Message-ID <002c01c6ed3a$47f34850$165aa8c0@Olympus>
Jim,

It appears the following character class is rejected by RE:
 [-\\w]

I believe this is a bug in RE. You can get around the problem by reversing
the expression to:
 [\\w-]

 Reuben

-----Original Message-----
From: Jim K [mailto:[email protected]] 
Sent: Tuesday, October 10, 2006 3:27 PM
To: [email protected]
Subject: Bad character class exception on pattern that works for JDK's
Pattern class

I'd like to use a email validation pattern that I came across on a Perl
users
board.  It works just fine with Java's regex.Pattern class but fails to
compile
when using Apache Regexp.  The RECompiler class returns a Bad character 
exception.  

The pattern I'm trying to use is:

^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA
-Z]
{2,9})$

If I strip out all the groups then RE will accept the pattern.  I know that
RE
supports groups, but maybe not nested groups?



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