I want to restrict the users from entering the below special characters in a field:
œçşÇŞ ğĞščřŠŘŇĚŽĎŤČňěž ůŮ İťı —¿„”*@ Newline Carriage return
A few more will be added to this list but I will have the complete restricted list eventually.
But he can enter certain foreign characters like äöüÄÖÜÿï
etc in addition to alphanumeric chars, usual special chars etc.
Is there an easy way to build a regex for doing this. Adding so many chars in the not allowed list like
[^œçşÇŞ ğĞščřŠŘŇĚŽĎŤČňěž ůŮ İ ť ı — ¿ „ ” * @]+
does not seem to work.
And I do not have the complete list of allowed characters. It would be too long even if I try to get it and would include all chars like:
~`!#$%^&()[]{};':",.
along with certain foreign chars.
You do not mention what "flavor" of regex you are using. Does the following work?
\A[^œçşÇŞ ğĞščřŠŘŇĚŽĎŤČňěž ůŮ İ ť ı — ¿ „ ” * @]+\z
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With