JavaScript RegExp ?! Quantifier
- 上一页 ?=
- 下一页 constructor
- 返回上一层 Kwamtaranci JavaScript RegExp
Definition and usage
?!n Quantifiers to match any string that is not immediately followed by a specified string n string.
Tip:Use ?=n Quantifiers to match any string that is immediately followed by a specified string n string.
Example
Search globally and case-insensitively for "is", not immediately followed by "all":
let text = "Is this all there is"; let pattern = /is(?! all)/gi;
Syntax
new RegExp("regexp(?!n)\)
or abbreviated:
/regexp(?!n)/
Syntax with modifiers
new RegExp("regexp(?!n)\"g\")
or abbreviated:
/regexp(?!n)/g
browser supports
/(?!n)/
是 ECMAScript1 (ES1) 特性。
所有浏览器都完全支持 ES1 (JavaScript 1997):
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
- 上一页 ?=
- 下一页 constructor
- 返回上一层 Kwamtaranci JavaScript RegExp