Package: effect
Module: RegExp
Escapes special characters in a regular expression pattern.
When to use
Use to turn literal text into a safe regular expression pattern fragment.
Example (Escaping a pattern string)
import { RegExp } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(RegExp.escape("a*b"), "a\\*b")
Signature
declare const escape: (string: string) => string
Since v2.0.0