-2

I am using the following regex to validate a password field in my JS code

^(?=.*[\p{Ll}])(?=.*[\p{Lu} ])(?=.*\d)[\p{Ll}\p{Lu}\d]{8,}$

This essentially looks out for atleast 1 uppercase and one lowercase letter .

This fails to match text like Näppäimistö from the finnish dialect.

What should I do to get this working correctly ?

Alastair McCormack
  • 26,573
  • 8
  • 77
  • 100
Aditya Kaushik
  • 213
  • 1
  • 4
  • 20

1 Answers1

0

Use this regular expression; it works for my password field.

  (/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,}$/)
José Castro
  • 661
  • 6
  • 14
Bharat
  • 5,869
  • 4
  • 38
  • 58
  • OP says: *This essentially looks out for atleast 1 uppercase and one lowercase letter.* Does your pattern support that? – Shafizadeh Apr 05 '16 at 12:54
  • yes my friend, but it also for minimum 8 characters, 1 numbers etc. actually i forgot what's requirement it fulfills, but i never need to change this regex for my codes. – Bharat Apr 05 '16 at 12:57
  • thanks @Jose castro. – Bharat Apr 05 '16 at 13:07