Skip character in range

I have a regex: /["-,]/

Which matches a character in the range from :

to ,

I want to skip the match for '

(apostrophe). Any help!

regex.test(strInput);

      

returns true for a string with an apostrophe. I need to reverse this line that has an apostrophe

+3


source to share


1 answer


You can use negative lookahead:

/(?!')["-,]/

      



Here (?!')

is a negative lookahead, which means that the next character must not be a single quote.

+1


source







All Articles