0

In my code I had a Password RegEx (written by someone) (/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[\x20-\x7E]{8,40}$/) which was not supporting french characters. And I modified it a bit to support french characters. And /^(?=.*[a-z])(?=.*[A-Z])(?:.*[àâäæèéêëîïôœùûüÿçÀÂÄÈÉÊËÎÏÔŒÙÛÜŸÇ]*)(?=.*\d)[\x20-\x7E]{8,40}$/ is the new RegEx. But this one does not work as expected. The behavior changes with the position of the french character. For example, NewàTest123! - works and NewTàest123! does not works

Any thoughts on why it fails when the position of the character changes?

1 Answers1

0

Working regex:

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[\x20-\x7EàâäæèéêëîïôœùûüÿçÀÂÄÈÉÊËÎÏÔŒÙÛÜŸÇ]{8,40}$

Thanks to @Wiktor Stribiżew

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92