MDN self-hosted library · e01.org

declarativeNetRequest.isRegexSupported()

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

no runnable cells webextension-api-function upstream source

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

Syntax

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

Parameters

  • regexOptions
  • : An object containing the regular expression to check.
    • isCaseSensitive
    • : boolean Whether the regex specified is case sensitive. Default is true.
    • regex
    • : string The regular expression to check.
    • requireCapturing
    • : 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
  • : 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