-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
  • 25,004
  • 7
  • 71
  • 96
Aditya Kaushik
  • 203
  • 4
  • 19

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
  • 641
  • 6
  • 14
Bharat
  • 5,419
  • 4
  • 35
  • 55
  • 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