Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

escape-regexp

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

escape-regexp

Escape regular expression special characters

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
142K
decreased by-2.39%
Maintainers
1
Weekly downloads
 
Created

What is escape-regexp?

The escape-regexp npm package is a utility that helps in escaping special characters in strings to be used in regular expressions. This is particularly useful when you need to dynamically create regular expressions from user input or other sources that may contain characters with special meanings in regex.

What are escape-regexp's main functionalities?

Escape special characters

This feature allows you to escape special characters in a string so that it can be safely used in a regular expression. In the example, the period and question mark are escaped.

const escapeRegExp = require('escape-regexp');
const userInput = 'Hello. How are you?';
const escapedInput = escapeRegExp(userInput);
console.log(escapedInput); // Output: 'Hello\. How are you\?'

Other packages similar to escape-regexp

Keywords

FAQs

Package last updated on 19 Oct 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc