Skip to main content

Built and signed on GitHub Actions

An extremely simple JavaScript RegExp-based lexer.

This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
100%
Published
a week ago (0.1.2)
function escapeRegExp
escapeRegExp(input: string): string

Escape the string for insertion into a RegExp pattern without special meanings.

The output of this function should NOT be placed inside a character class or other weird, non-concatenable positions of a RegExp.

The characters escaped are: ^ $ \ . * + ? ( ) [ ] { } |

Source: https://tc39.es/ecma262/#prod-SyntaxCharacter

Parameters

input: string

Return Type

Add Package

deno add @seally/simple-lexer

Import symbol

import { escapeRegExp } from "@seally/simple-lexer";

---- OR ----

Import directly with a jsr specifier

import { escapeRegExp } from "jsr:@seally/simple-lexer";

Add Package

npx jsr add @seally/simple-lexer

Import symbol

import { escapeRegExp } from "@seally/simple-lexer";

Add Package

yarn dlx jsr add @seally/simple-lexer

Import symbol

import { escapeRegExp } from "@seally/simple-lexer";

Add Package

pnpm dlx jsr add @seally/simple-lexer

Import symbol

import { escapeRegExp } from "@seally/simple-lexer";

Add Package

bunx jsr add @seally/simple-lexer

Import symbol

import { escapeRegExp } from "@seally/simple-lexer";