class Wildcard

Pattern matching class that supports:

  1. Plain string matching (substring search)
  2. Wildcard patterns with * (glob-style)
  3. Full regular expressions when wrapped in /regex/

Constructors

new
Wildcard(pattern: string)

Creates a new Wildcard pattern matcher.

Properties

readonly
isPlain: boolean

Checks if this is a plain string pattern.

readonly
isRegex: boolean

Checks if this is a regex pattern.

readonly
isWildcard: boolean

Checks if this is a wildcard pattern.

readonly
pattern: string

Gets the pattern string.

private
readonly
plainStr: string
private
readonly
regex: RegExp | null

Methods

test(str: string): boolean

Tests if the pattern matches the given string.

toString(): string

Returns the original pattern string.