On 14 août, 15:59, davis <[email protected]> wrote:
> I think I figured out the problem, using an online regex tester for
> JavaScript:http://www.pagecolumn.com/tool/regtest.htm
>
> Note that the regex translation in JavaScript has a double backslash
> to escape the \d special character.  This fails standard regex test
> for JavaScript for inputs like abcd1234.
>
> ^(?=.*\\d)(?=.*[a-z]).{8,15}$
>
> If you replace the regex text with:
>
> ^(?=.*\d)(?=.*[a-z]).{8,15}$
>
> Then it works for JavaScript.  However, Java requires the character to
> be escaped.  I'm guessing Firefox simply interprets \\d as \d, which
> is why it passes, but IE is not as forgiving.  This seems like a bug
> in the GWT compiler.  It seems to me it should take the \\d and
> translate it to \d when compiling from Java to JavaScript.
>
> Can someone confirm?

The problem I see is with your regex potentially (I mean, how it'll be
interpreted by the browser's JS engine). Why don't you simply write it
as either of the following?

   ^[a-z0-9]{8,15}$
   ^([a-z]|\d){8,15}$
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to