Skip to content

RegExp

This module provides utility functions for working with RegExp in TypeScript.

2 exports Added in v2.0.0 Source

Guards

isRegExp

Added in v3.9.0 Source

Tests if a value is a RegExp.

Signature

declare const isRegExp: (input: unknown) => input is RegExp;

Example

import * as assert from "node:assert"
import { RegExp } from "effect"

assert.deepStrictEqual(RegExp.isRegExp(/a/), true)
assert.deepStrictEqual(RegExp.isRegExp("a"), false)

Other

escape

Added in v2.0.0 Source

Escapes special characters in a regular expression pattern.

Signature

declare function escape(string: string): string;