3

I use this to validate a password that has to have 8 characters, one capital letter and numeric but when I add an asterisk to it it throws an error saying passwords do not match, this only happens using the asterisk.

Any help will be appreciate it

ng-pattern="/(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/"
Christos
  • 53,228
  • 8
  • 76
  • 108
Gilberto Quintero
  • 397
  • 1
  • 6
  • 18

2 Answers2

0

Try this one:

/^(?=.*[a-z])(?=.*\d)(?=.*[A-Z]).{8,}$/

You can test here: http://regexr.com/3c65b

inorganik
  • 24,255
  • 17
  • 90
  • 114
0

Perhaps something like that:

ng-pattern="/^(?=.*[\d\W])(?=.*[A-Z])(?=.*[a-z])[^.\n].{7,}$/"

or more hand-driven:

ng-pattern="/^(?=[^\d\W]*[\d\W])(?=[^A-Z]*[A-Z])(?=[^a-z]*[a-z])[^.\n].{7,}$/"
Casimir et Hippolyte
  • 88,009
  • 5
  • 94
  • 125