Reputation: 61
I am writing a JavaScript regular expression to match a string containing any possible character (including spaces) except any of the following five special characters <,>,",/,\
. I have tried using ^
inside []
which skips matching the characters inside []
such as /[^<>""\\/]/
but this doesn't seem to work as expected
Upvotes: 0
Views: 63
Reputation: 3826
You almost did it, use this: /^[^<>"\/\\]*$/
.
Demo: https://regex101.com/r/s7DEKm/1.
Upvotes: 3