I want to allow only specific special characters like in a text like ?*=.@#$%!^":,:;<'>+-_
.
I have tried the below code:
pattern = new RegExp(/^(?=.*?[?*=.@#$%!^":,:;<'>+-_])/);
It does not seem to work, it seems to pass even if I am entering a special character other than the ones specified above. Am I missing something here?
e.g.:
var sampleText: string = "TestSample&123"
The above example should throw an error and fail since I have not used any of the special character which is specified in the pattern.