string-escape-regex

A tiny function for escaping a string to be used as the source in a regex.

MIT 2 个版本
安装
npm install string-escape-regex
yarn add string-escape-regex
pnpm add string-escape-regex
bun add string-escape-regex
README

String Escape Regex

A tiny function for escaping a string to be used as the source in a regex.

Install

npm install string-escape-regex

Usage

import escape from 'string-escape-regex';

// Let's escape a string to be used in a regex

escape ( 'foo()' ); // => 'foo\\(\\)'

License

MIT © Fabio Spampinato

版本列表
1.0.1 2025-01-19
1.0.0 2022-05-06