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: regexp-user@jakarta.apache.org
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]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to