Escape String Regexp

Escape RegExp special characters
Alternatives To Escape String Regexp
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Path To Regexp7,619534,1745,8822 months ago53May 06, 202220mitTypeScript
Turn a path string such as `/user/:name` into a regular expression
Super Expressive4,474
4 months ago10mitJavaScript
🦜 Super Expressive is a zero-dependency JavaScript library for building regular expressions in (almost) natural language
Randexp.js1,76919,7063896 months ago20July 21, 201811mitJavaScript
Create random strings that match a given regular expression.
4 years ago9February 09, 20201Clojure
Transform collections of strings into regular expressions.
Tiny Regex C1,005
9 months ago32unlicenseC
Small portable regex in C
Regexp Examples48362153 years ago42January 09, 20208mitRuby
Generate strings that match a given regular expression
Re Build472
6 years ago2July 25, 2016mitJavaScript
Building regular expressions with natural language
Escape String Regexp436773,9462,4322 years ago10April 17, 20211mitJavaScript
Escape RegExp special characters
7 months ago6April 28, 20224mitRust
Masking tape to help commands "do one thing well"
Node Re24284055a month ago52June 12, 20223otherJavaScript
node.js bindings for RE2: fast, safe alternative to backtracking regular expression engines.
Alternatives To Escape String Regexp
Select To Compare

Alternative Project Comparisons


Escape RegExp special characters


$ npm install escape-string-regexp


import escapeStringRegexp from 'escape-string-regexp';

const escapedString = escapeStringRegexp('How much $ for a ?');
//=> 'How much \\$ for a \\?'

new RegExp(escapedString);

You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.
Popular Character Projects
Popular Regular Expression Projects
Popular Text Processing Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Regular Expression