Regex & String Escape Characters List

Grab a clean, copy-ready list of common escape sequences used in regex patterns and string literals. Covers newlines, tabs, unicode escapes, and more across mainstream languages.

Regex & string escape characters(39 escape sequences)

Covers escape sequences common across JavaScript, Python, Java, C, and regex engines; some sequences (e.g. \a, \v, octal) are language-specific and may not apply in all contexts.

How to use this list

Copy escape sequences in seconds

Takes ~5 seconds
  1. 1
    Choose a format

    Pick text for docs, JSON for code, or HTML for dropdown menus.

  2. 2
    Copy or download

    Hit the copy button or download the file for offline reference.

  3. 3
    Paste into your project

    Use the sequences in regex patterns, string literals, documentation, or a cheat-sheet UI.

Need just the bare sequences? Select JSON to get a clean array of escape values without descriptions.

Who should use this list?

  • Developers writing regex patterns or string literals who need a quick escape sequence reference
  • Technical writers documenting language syntax or building escape-character cheat sheets
  • Educators and students learning string encoding and regex fundamentals across languages

Examples

Text output with sequence and meaning.

Input
\n — Newline (line feed)
Output
\n — Newline (line feed)

JSON output — bare escape sequences only.

Input
"\\n"
Output
["\\n", "\\t", "\\r", "\\\\", "\\0", ...]

HTML output for a dropdown menu.

Input
\n — Newline (line feed)
Output
<option value="\n">\n — Newline (line feed)</option>

A complete regex & string escape characters reference

Use this list as a reliable quick-reference for escape sequences when writing regex patterns, string literals, or language documentation.

Looking for a dependable regex and string escape characters list to use in code, documentation, or a cheat sheet? This page collects the most common escape sequences found across mainstream languages including JavaScript, Python, Java, and C, as well as standard regex engines. It covers whitespace escapes like \n (newline), \t (tab), and \r (carriage return); encoding escapes like \uXXXX, \u{XXXX}, \xXX, and octal \ooo; string-safe escapes like \\ (literal backslash), \' and \"; and regex-specific tokens like \d, \w, \s, \b, and the full set of metacharacter escapes. Each item pairs the bare escape sequence with a plain-language description so you can scan quickly and paste with confidence. The text format is ideal for cheat sheets and documentation, JSON gives you a clean machine-usable array of sequences, and HTML generates ready-to-paste option tags for dropdowns or training tools. Whether you are building a regex tester, writing API docs, or teaching a programming course, this list saves you from hunting through language specs for the escape syntax you need.

String & regex sequences

Includes both string literal escapes and regex-specific character classes and assertions.

  • Whitespace escapes (\n, \t, \r)
  • Regex classes (\d, \w, \s)
  • Regex metacharacter escapes
Unicode & hex support

Covers the main encoding escapes used across modern languages.

  • \uXXXX and \u{XXXX}
  • \xXX hex escape
  • \N{name} named Unicode
Copy-ready formats

Switch between text, JSON, and HTML formats with one click for any workflow.

  • Plain text list
  • JSON array of sequences
  • HTML <option> tags

Escape character best practices

Always verify escape sequence support in the specific language or regex engine you are targeting.

  • Check whether your language uses \uXXXX, \u{XXXX}, or \xXX for unicode — they are not universally interchangeable.
  • In regex, escape metacharacters (. * + ? ^ $ | \ ( ) [ ] { }) with \\ before using them as literals.
  • Distinguish string-level escapes from regex-level escapes — \b means backspace in a string but word boundary in a regex pattern.

Frequently asked questions

Does this list cover regex-specific escapes as well as string escapes?>
Yes. The list includes both string literal escapes (\n, \t, \uXXXX, etc.) and regex-specific tokens (\d, \w, \s, \b, and metacharacter escapes like \. and \*).
Why does \b appear twice in the list?>
\b has two distinct meanings depending on context: in a string literal it is a backspace character, while in a regex pattern it is a word boundary assertion. Both are listed to make the distinction clear.
Are all of these sequences supported in every language?>
No. Some sequences — such as \a (alert/bell), \v (vertical tab), octal escapes, and \N{name} — are language-specific. Always check the docs for the language or regex engine you are using.

Related Developer lists

Application MIME Types List | Copy-Ready Text, JSON & HTML

Copy common application/* MIME types in text, JSON, or HTML format for API content negotiation, downloads, and file validation.

Audio MIME Types List | Copy-Ready Text, JSON & HTML

Copy common audio MIME types in text, JSON, or HTML format for uploads, playback support checks, and processing pipelines.

Common MIME Types List | Copy-Ready Text, JSON & HTML

Copy a practical common MIME types list in text, JSON, or HTML format for uploads, APIs, validation, and content handling.

Compressed & Archive File Extensions List

Copy common compressed and archive file extensions in text, JSON, or HTML format. Useful for file validators, dropdowns, and developer references.

Document File Extensions List

Copy common document file extensions with format names in text, JSON, or HTML format. Ideal for developers, docs, and file type references.

Executable File Extensions List

Copy common executable and installer file extensions by platform in text, JSON, or HTML format for quick reference, docs, and developer tools.

HTTP 2xx Success Codes List | Copy-Ready Text, JSON & HTML

Copy all HTTP 2xx success codes in text, JSON, or HTML format for API docs, tests, and monitoring workflows, ready to paste.

HTTP 3xx Redirect Codes List | Copy-Ready Text, JSON & HTML

Copy all HTTP 3xx redirect codes in text, JSON, or HTML format for API docs, tests, and monitoring workflows, ready to paste.

HTTP 4xx Error Codes List | Copy-Ready Text, JSON & HTML

Copy all HTTP 4xx client error codes in text, JSON, or HTML format for API docs, tests, and monitoring workflows.

HTTP 5xx Error Codes List | Copy-Ready Text, JSON & HTML

Copy all HTTP 5xx server error codes in text, JSON, or HTML format for API docs, tests, and monitoring workflows.

HTTP Request Methods List | Copy-Ready Text, JSON & HTML

Copy a clean http request methods list (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE, CONNECT) in text, JSON, or HTML for API docs and tooling.

HTTP Status Codes List | Copy-Ready Text, JSON & HTML

Copy the complete IANA-registered HTTP status codes list in text, JSON, or HTML format for APIs, docs, testing, and observability workflows.

Image MIME Types List | Copy-Ready Text, JSON & HTML

Copy common image MIME types in text, JSON, or HTML format for upload validation, image processing, and media tooling.

JSON Data Types List

Copy all 6 native JSON data types from RFC 8259 in text, JSON, or HTML format for quick reference, docs, and dropdown menus.

Video MIME Types List | Copy-Ready Text, JSON & HTML

Copy common video MIME types in text, JSON, or HTML format for upload policies, streaming workflows, and player support checks.