跳过范围内的角色(Skip a character in range)
我有一个正则表达式: /["-,]/它匹配范围内的字符: to ,我想跳过' (撇号)的匹配。任何帮助!!
regex.test(strInput);对于带有撇号的字符串,它返回true。 我需要否定那个有撇号的字符串
I have a regular expression : /["-,]/ Which matches a character in range of : to , I want to skip the match for '(apostrophe). Any help !!
regex.test(strInput);is returning true for a string with an apostrophe. I need to negate that string which has an apostrophe
最满意答案
您可以使用否定前瞻:
/(?!')["-,]/这里(?!')是负向前瞻 ,这意味着下一个字符不能是单引号。
You can use negative lookahead:
/(?!')["-,]/Here (?!') is negative lookahead which means next character must not be single quote.
更多推荐
发布评论