I am using following regular expression my java code.
^.*(?=.{6,20})(?=.*[a-z].*[a-z])(?=.*[A-Z])(?=.*[0-9]).*$
When I am trying to use same in xml as
^.\*(\?=.{6,20})(\?=.\*[a-z].\*[a-z])(\?=.\*[A-Z])(\?=.\*[0-9]).\*$
It is not working. It showing exception as below.
java.lang.IllegalArgumentException: cvc-pattern-valid: Value 'narendra1A' is not facet-valid with respect to pattern '^.*(\?=.{6,20})(\?=.*[a-z].*[a-z])(\?=.*[A-Z])(\?=.*[0-9]).*$' for type '#AnonType_passwordcreateUser'.
Can any one help in this regard.
Thanks,
Narendra
.*right after the^. It's unnecessary and makes your regex very inefficient. Also, if you think you're restricting the password length to 6-20 characters, you're not. A 100-character string will pass this regex just fine.