I got a regex-validator on my asp.net page that validates the password. Regular expression
^(?=.*[0-9])(?=.*[a-zæøåA-ZÆØÅ])[a-zA-ZæøåÆØÅ0-9]{6,}$
.. Now it works fine in IE8 and FF3, but it checks for false no matter what I try to use in IE7. Are there any errors I should know about this ?: S
Thanks in advance.
IE7 doesn't seem to like {6,} at the end of the line. Found several articles about this on the Internet. Anyway, the solution was to put it in the area separately :)
^(?=.{6,}$)(?=.*[0-9])(?=.*[a-zæøåA-ZÆØÅ])[a-zA-ZæøåÆØÅ0-9]*
You need to code your entities. Try the following:
^(?=.*[0-9])(?=.*[az\xE6\xF8\xE5A-Z\xC6\xD8\xC5])[a-zA-Z\xE6\xF8\xE5A-Z\xC6\xD8\xC50-9]{6,}$
It looks like you have some encoding problems with your example. If you absolutely do not need to have it on the client side, I recommend using CustomValidator, which checks that it executes your logic using the OnServerValidate event handler. Server-side validation does not allow you to switch to browser compatibility from javascript regular expressions.
I also had problems with Internet Explorer 7.
Here is what I was able to use to require 8 characters, with a number and a number (allowing for spaces):
(?!^[0-9]*$)(?!^[ a-zA-Z!@ #$%^&*()_+=<>?]*$)^([ a-zA-Z!@ #$%^&*()_+=<>?0-9]{8,20})$