Reputation: 11287
I got a regex-validator on my asp.net page, which validates a password. The regex is
^(?=.*[0-9])(?=.*[a-zæøåA-ZÆØÅ])[a-zA-ZæøåÆØÅ0-9]{6,}$
.. Now, it works fine in IE8 and FF3, but it validates to false no matter what I try in IE7. Are there any knows bugs, I should know about here? :S
Thanks in advance..
Upvotes: 4
Views: 753
Reputation: 7128
I also had problems with Internet Explorer 7.
Here is what I was able to use, to require 8 characters, with a digit and number (allowing spaces):
(?!^[0-9]*$)(?!^[ a-zA-Z!@#$%^&*()_+=<>?]*$)^([ a-zA-Z!@#$%^&*()_+=<>?0-9]{8,20})$
Upvotes: 0
Reputation: 11287
Seems like IE7 doesn't like the {6,} at the end of the string. Found some articles about this around the web. Anyway, the solution was to put it in a region by itself :)
^(?=.{6,}$)(?=.*[0-9])(?=.*[a-zæøåA-ZÆØÅ])[a-zA-ZæøåÆØÅ0-9]*
Upvotes: 1
Reputation: 95424
You need to encode your entities. Try the following:
^(?=.*[0-9])(?=.*[a-z\xE6\xF8\xE5A-Z\xC6\xD8\xC5])[a-zA-Z\xE6\xF8\xE5A-Z\xC6\xD8\xC50-9]{6,}$
Upvotes: 1
Reputation: 6562
Looks like you are having some encoding issues with your example there. Unless you absolutely have to have it on the client side, I recommend using a CustomValidator that validates on that executes your logic via the OnServerValidate event handler. Validating on the server side keeps you out of the javascript regular expressions cross browser compatability weirdness.
Upvotes: 0