declarativeNetRequest.isRegexSupported
检查是否支持将某个正则表达式作为 declarativeNetRequest.RuleCondition
.regexFilter
规则的条件。
语法
js
let count = browser.declarativeNetRequest.isRegexSupported(
regexOptions // 对象
);
参数
regexOptions
-
一个包含要检查的正则表达式的对象。
isCaseSensitive
可选-
boolean
。正则表达式是否区分大小写。默认值为true
。 regex
-
string
。要检查的正则表达式。 requireCapturing
可选-
boolean
。是否需要捕获。只有在指定了 regexSubstitution 操作的重定向规则中需要捕获。默认值为false
。
返回值
一个 Promise
,其会兑现一个对象,具有以下属性:
isSupported
-
boolean
。正则表达式是否支持。 reason
可选-
string
。指定正则表达式不支持的原因。可能的值为"syntaxError"
和"memoryLimitExceeded"
。仅在isSupported
为 false 时提供。
如果请求失败,promise 将被拒绝并带有错误消息。
示例
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
isRegexSupported |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.