Checks if a regular expression is supported as a declarativeNetRequest.RuleCondition.regexFilter rule condition.
On this page
declarativeNetRequest.isRegexSupported
Syntax
let count = browser.declarativeNetRequest.isRegexSupported(
regexOptions // object
);
Parameters
-
regexOptions -
An object containing the regular expression to check.
isCaseSensitiveOptional-
booleanWhether the regex specified is case sensitive. Default istrue. -
regex -
stringThe regular expression to check. requireCapturingOptional-
booleanWhether the regex specified requires capturing. Capturing is only required for redirect rules that specify a regexSubstitution action. The default is false.
Return value
A Promise that fulfills with an object with these properties:
-
isSupported -
booleanWhether the regular expression is supported. reasonOptional-
stringSpecifies the reason why the regular expression is not supported. Possible values are"syntaxError"and"memoryLimitExceeded". Only provided ifisSupportedis false.
If the request fails, the promise is rejected with an error message.
Examples
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
isRegexSupported |
87 | 87 | No | ? | 73 | 15 | ? | ? | No | ? | 15 | ? |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/isRegexSupported