For example:
If I write hello@#$%^ it would return false just because it includes a special character I prohibited.
If I write hello it would be true.
If I write $, it will be false.
The list of characters I want to exclude is similar to: ` ~ ! @ # $ % ^ & * { } [ ] ” ‘ : ; , . < > ? / | \
I just need a regex to detect if any of those following characters are in a string if they are it would return false. Thanks and sorry for the informality.
Regards,
Sam
Depending on your intent, the simplest approach might be to enumerate the characters you do want to allow, a la:
This would allow any alphanumeric string containing underscores and spaces. If you really do need to just match strings containing an explicitly enumerated list of forbidden characters, then you will have to enumerate them and escape the ones that are special regex characters:
A couple of notes: