Skip to content

API > wxt/utils/match-patterns > 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/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:23

Properties

convertPatternToRegex

private convertPatternToRegex: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:34


escapeForRegex

private escapeForRegex: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:35


hostnameMatch

private hostnameMatch: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:14


isAllUrls

private isAllUrls?: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:16


isFileMatch

private isFileMatch: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:31


isFtpMatch

private isFtpMatch: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:32


isHostPathMatch

private isHostPathMatch: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:28


isHttpMatch

private isHttpMatch: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:26


isHttpsMatch

private isHttpsMatch: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:27


isPathMatch

private isPathMatch: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:30


isUnknownProtocol

private isUnknownProtocol: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:29


isUrnMatch

private isUrnMatch: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:33


pathnameMatch

private pathnameMatch: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:15


protocolMatches

private protocolMatches: any

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:13


PROTOCOLS

static PROTOCOLS: string[]

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:12

Methods

includes()

includes(url): boolean

Check if a URL is included in a pattern.

Parameters

url: string | URL | Location

Source

node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:25


Generated using typedoc-plugin-markdown and TypeDoc