About Regex Escape
This tool converts plain text into regex-safe literals so special tokens like ., *, and ? are treated as normal characters.
Key Features
- Regex Escape: Escapes regex metacharacters automatically.
- Unescape: Restores escaped text for review or editing.
- Swap Input/Output: Quickly switch directions.
- Sample + Copy: Test quickly and copy results.
Common Metacharacters
| Char | Meaning | Escaped |
|---|---|---|
. |
any single char | \\. |
* |
zero or more | \\* |
+ |
one or more | \\+ |
? |
zero or one | \\? |
[ ] |
char class | \\[ \\] |
( ) |
grouping | \\( \\) |
Steps
- Enter source text.
- Click escape to generate regex-literal-safe content.
- Click unescape when needed.
- Copy output into code or shell usage.
FAQ
When should I always escape first?
When text comes from users or external input and should be matched literally.
Does unescape remove all backslashes?
No. It only converts valid escaped regex tokens back to their literal form.