declarativeNetRequest.isRegexSupported

Checks if a regular expression is supported as a declarativeNetRequest.RuleCondition.regexFilter rule condition.

Syntax

js
let count = await browser.declarativeNetRequest.isRegexSupported(
    regexOptions                // object
);

Parameters

regexOptions

An object containing the regular expression to check.

isCaseSensitive Optional

boolean Whether the regex specified is case sensitive. Default is true.

regex

string The regular expression to check.

requireCapturing Optional

boolean Whether 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

boolean Whether the regular expression is supported.

reason Optional

string Specifies the reason why the regular expression is not supported. Possible values are "syntaxError" and "memoryLimitExceeded". Only provided if isSupported is false.

If the request fails, the promise is rejected with an error message.

Examples

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
isRegexSupported
Chrome – Full support
Chrome 87 (Release date: 2020-11-17)
footnote Full support
Edge – Full support
Edge 87 (Release date: 2020-11-19)
footnote Full support
Firefox – Full support
Firefox 113 (Release date: 2023-05-09)
footnote Full support
Opera – Full support
Opera 73 (Release date: 2020-12-09)
footnote Full support
Safari – Full support
Safari 15 (Release date: 2021-09-20)
footnote Full support
Firefox for Android – Full support
Firefox for Android 113 (Release date: 2023-05-09)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support