@ende/regexp
ende add jsr:@ende/regexpVersion 2026.10.15 on JSR.
Functions for tasks related to regular expression (regexp), such as escaping text for interpolation into a regexp.
import { escape } from "@ende/regexp/escape";
import { assertEquals, assertMatch, assertNotMatch } from "@ende/assert";
const re = new RegExp(`^${escape(".")}$`, "u");
assertEquals("^\\.$", re.source);
assertMatch(".", re);
assertNotMatch("a", re);
Modules
Exports
escape— Escapes arbitrary text for interpolation into a regexp, such that it will match exactly that text and nothing else.