sindresorhus

escape-string-regexp

Escape RegExp special characters

by sindresorhus

JavaScript

JavaScript86.9%
TypeScript13.1%

Commit activity

Last 12 weeks · 1 commit

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template
dlamb3241-create

Adds test coverage to lock in explicit input validation and ensure correct behavior for empty strings and unicode inputs. If this saves time, I’m happy to accept GitHub Sponsorship for the work.

dlamb3241-create · 9mo ago
r-browser-app-team

MIT license needs both of year and copyright holder. Please complete MIT license. We want to use this without legal risk.

r-browser-app-team · 1y ago
slevithan

There have been multiple requests to escape additional characters, so this makes it clearer that minimal escaping is done, per https://github.com/sindresorhus/escape-string-regexp/issues/30#issuecomment-698328200. It also gives a solution for more involved context-aware escaping that handles numerous edge cases, for situations when developers need to insert an escaped string at an arbitrary position in a regex. Fixes #30

slevithan · 1y ago
Structured data for AI agents

Repository: sindresorhus/escape-string-regexp. Description: Escape RegExp special characters Stars: 595, Forks: 60. Primary language: JavaScript. Languages: JavaScript (86.9%), TypeScript (13.1%). License: MIT. Latest release: v5.0.0 (5y ago). Open PRs: 0, open issues: 0. Last activity: 1mo ago. Community health: 85%. Top contributors: sindresorhus, charmander, jbnicolai, coreyfarrell, BendingBender, Richienb, slevithan.