REGEX ESCAPE TOOL

Escape regex special characters so text matches literally, in your choice of flavor. Nothing leaves your browser.

|
Escaped pattern

How to escape text for a regex

  1. 1

    Pick Escape or Unescape.

  2. 2

    Choose the regex flavor you are targeting.

  3. 3

    Paste or type your text.

  4. 4

    Copy the result into your pattern.

Questions

Which characters need escaping in a regex?
Metacharacters such as . * + ? ^ $ { } ( ) | [ ] and the backslash itself must be escaped with a backslash to match literally.
Why are there different flavors?
Languages differ slightly: Python's re.escape also escapes characters like - & ~ # and whitespace, while POSIX tools only need the core metacharacters.
Can I turn an escaped pattern back into plain text?
Yes. Switch to Unescape to strip backslashes before punctuation and restore \n, \t and \r.
Is my text uploaded?
No. Escaping runs locally in your browser.

Related tools

All Developer Tools →