regexp.ts

view source

Declarations
#

2 declarations

escape_regexp
#

regexp.ts view source

(str: string): string import {escape_regexp} from '@fuzdev/fuz_util/regexp.js';

Escapes a string for literal matching in a RegExp.

str

type string

returns

string

reset_regexp
#

regexp.ts view source

<T extends RegExp>(regexp: T): T import {reset_regexp} from '@fuzdev/fuz_util/regexp.js';

Reset a RegExp's lastIndex to 0 for global and sticky patterns. Ensures consistent behavior by clearing state that affects subsequent matches.

regexp

type T

returns

T

generics

reset_regexp<T extends RegExp>
T
constraint RegExp

mutates

  • regexp — sets lastIndex to 0 if regexp is global or sticky