1๐
We should use the object format of the rules instead.
Heads up!
You should not use the pipe โ|โ or commas โ,โ within your regular
expression when using the string rules format as it will cause a
conflict with how validators parsing works. You should use the object
format of the rules instead.
v-validate="{required: true, min:8, max:20,
regex:/^(?=(.*?[a-z].*?[A-Z])|(.*?[a-z].*?[0-9])|(.*?[a-z].*?[!@#$%^&*()_+])|(.*?[A-Z].*?[0-9])|(.*?[A-Z].*?[!@#$%^&*()_+])|(.*?[0-9].*?[!@#$%^&*()_+]))/}"
Update the latest regex: At least two characters from uppercase, lowercase, numbers, and symbols.
v-validate="{required: true, min:8, max:20,
regex:/^(?=(.*?[a-z].*?[A-Z])|(.*?[A-Z].*?[a-z])|(.*?[a-z].*?[0-9])|(.*?[0-9].*?[a-z])|(.*?[a-z].*?[!@#$%^&*()_+])|(.*?[!@#$%^&*()_+].*?[a-z])|(.*?[A-Z].*?[0-9])|(.*?[0-9].*?[A-Z])|(.*?[A-Z].*?[!@#$%^&*()_+])|(.*?[!@#$%^&*()_+].*?[A-Z])|(.*?[0-9].*?[!@#$%^&*()_+])|(.*?[!@#$%^&*().*?[0-9]_+])).*$/}"
๐คMrXo
Source:stackexchange.com