i want to write a pattern for password field that users must use metachars for them passwords (metacharacters like :!@#$%^&*() ), i search about it but didnt find any pattern , is this possible to write such pattern ?
Thanks in Advance
i want to write a pattern for password field that users must use metachars
Share
If you are looking for a regexp that will match all special characters, you have a few ways you could go:
You could write a regexp that excludes alphanumerics:
/[^a-zA-Z0-9]/
You could select the special characters that you are interested in and, carefully escaping the ones that have special meaning in regexps with a backslash, write your own regexp for that specific set of characters.
If you know what charset will be involved and if it’s reasonably small (so not UTF-8, which will be huge), you can go through it and identify the special chars and then do #2 above. This might be feasible if you are 100% certain that all data will come in as (for example) ASCII chars.