Skip to content

API > wxt/sandbox > MatchPattern

Class: MatchPattern

Class for parsing and performing operations on match patterns.

Contents

Example

ts
const pattern = new MatchPattern("*://google.com/*");

pattern.includes("https://google.com");            // true
pattern.includes("http://youtube.com/watch?v=123") // false

Constructors

new MatchPattern(matchPattern)

new MatchPattern(matchPattern): MatchPattern

Parse a match pattern string. If it is invalid, the constructor will throw an InvalidMatchPattern error.

Parameters

matchPattern: string

The match pattern to parse.

Source

node_modules/.pnpm/@webext-core+match-patterns@1.0.3/node_modules/@webext-core/match-patterns/lib/index.d.ts:22

Properties

PROTOCOLS

static PROTOCOLS: string[]

Source

node_modules/.pnpm/@webext-core+match-patterns@1.0.3/node_modules/@webext-core/match-patterns/lib/index.d.ts:11

Methods

includes()

includes(url): boolean

Check if a URL is included in a pattern.

Parameters

url: string | URL | Location

Source

node_modules/.pnpm/@webext-core+match-patterns@1.0.3/node_modules/@webext-core/match-patterns/lib/index.d.ts:26


Generated using typedoc-plugin-markdown and TypeDoc