negated character sets
。要创建negated character set
,请在caret
括号后面和不想匹配的字符前放置一个caret
( ^
)。例如, /[^aeiou]/gi
匹配所有不是元音的字符。请注意字符之类的.
, !
, [
, @
, /
和空格匹配 - 否定元音字符集仅排除元音字符。 myRegex
应匹配9项。
testString: 'assert(result.length == 9, "Your regex myRegex
should match 9 items.");'
- text: 你的正则表达式myRegex
应该使用全局标志。
testString: 'assert(myRegex.flags.match(/g/).length == 1, "Your regex myRegex
should use the global flag.");'
- text: 你的正则表达式myRegex
应该使用不区分大小写的标志。
testString: 'assert(myRegex.flags.match(/i/).length == 1, "Your regex myRegex
should use the case insensitive flag.");'
```