On 14 août, 18:31, Davis Ford <[email protected]> wrote:
> Thanks Thomas -- I don't have a good excuse other than I'm sick as a
> dog today, and running at only 60% ;)
>
> Honestly did not expect IE js regex implementation to not handle
> lookaheads, but whatever...this simple solution will work great.  I'm
> just leery of what other hidden issues lie out there.

Well actually, the regexps I proposed aren't equivalent to yours:
yours will match passwords containing non-alphanumeric chars (provided
they contain at least a number and a letter), while mine will only
match passwords containing *only* numbers and letters.

But given that you already checked the input length, why not just
search for those chars that your expecting? Something like:

   if (!text.matches(".*\\d.*") || !text.matches(".*[a-z].*")) { ... }

If I were you, I'd try using JSNI too:
  private native boolean matchesPasswordFormat(String text) /*-{
    return /^(?=.*\d)(?=.*[a-z]).{8,15}$/.test(text);
  }-*/;
or
  private native boolean matchesPasswordFormat(String text) /*-{
    return text.search(/\d/) >= 0 && text.search(/[a-z]/) >= 0;
  }-*/;
--~--~---------~--~----~------------~-------~--~----~
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