Regex escape
Escape special characters so a piece of text matches literally inside a regular expression.
Missing a feature or found a bug in Regex escape? Tell me on X (@_andrewtran) or by email.
How to use Regex escape
- Paste the text you want to match exactly.
- Tick the slash option if the pattern goes between two slashes.
- Copy the escaped pattern from the output pane.
Questions and answers
Is my data sent anywhere?
No. Everything runs in your browser on this device. Nothing you paste is uploaded or stored.
Which characters are escaped?
The ones with a meaning in a pattern: the dot, star, plus, question mark, caret, dollar sign, pipe, backslash and all three kinds of bracket.
Does it work outside JavaScript?
Yes. The same characters are special in most regex engines, including those in Python, Java, Go and PCRE.
Related tools
SQL IN clause generator
Turn a list of values into a SQL IN (…) clause, quoted and with duplicates removed.Subnet calculator
Find the network, broadcast address, host range and mask for any IPv4 address and CIDR prefix.Chmod calculator
Work out Unix file permissions with checkboxes, and convert between octal 755 and rwxr-xr-x.SemVer calculator
Parse a semantic version, compare two versions, check a range and see the next releases.