I am using the below regex in JavaScript for password policy check:
^.*(?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[@#$_])(?=.*[\d\W]).*$
I tried the above regex using online regex checker http://www.nvcc.edu/home/drodgers/ceu/resources/test_regexp.asp
Test cases passed as expected, negative test cases failed. But same regex when deployed in application does not validate properly.
For eg:
Tracker@123 does not work, where tRacker@123 works
Asd56544#12 also works fine.
Can you please point out what's wrong in regex above?
.*or the last group(?=.*[\d\W])? (not that it's your problem)