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- 1Choose a format
Pick text for docs, JSON for code, or HTML for dropdown menus.
- 2Copy or download
Hit the copy button or download the file for offline reference.
- 3Paste into your project
Use the sequences in regex patterns, string literals, documentation, or a cheat-sheet UI.
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.
\n — Newline (line feed)
\n — Newline (line feed)
JSON output — bare escape sequences only.
"\\n"
["\\n", "\\t", "\\r", "\\\\", "\\0", ...]
HTML output for a dropdown menu.
\n — Newline (line feed)
<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.
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
Covers the main encoding escapes used across modern languages.
- \uXXXX and \u{XXXX}
- \xXX hex escape
- \N{name} named Unicode
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?>
Why does \b appear twice in the list?>
Are all of these sequences supported in every language?>
Related Developer lists
Copy common application/* MIME types in text, JSON, or HTML format for API content negotiation, downloads, and file validation.
Copy common audio MIME types in text, JSON, or HTML format for uploads, playback support checks, and processing pipelines.
Copy a practical common MIME types list in text, JSON, or HTML format for uploads, APIs, validation, and content handling.
Copy common compressed and archive file extensions in text, JSON, or HTML format. Useful for file validators, dropdowns, and developer references.
Copy common document file extensions with format names in text, JSON, or HTML format. Ideal for developers, docs, and file type references.
Copy common executable and installer file extensions by platform in text, JSON, or HTML format for quick reference, docs, and developer tools.
Copy all HTTP 2xx success codes in text, JSON, or HTML format for API docs, tests, and monitoring workflows, ready to paste.
Copy all HTTP 3xx redirect codes in text, JSON, or HTML format for API docs, tests, and monitoring workflows, ready to paste.
Copy all HTTP 4xx client error codes in text, JSON, or HTML format for API docs, tests, and monitoring workflows.
Copy all HTTP 5xx server error codes in text, JSON, or HTML format for API docs, tests, and monitoring workflows.
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.
Copy the complete IANA-registered HTTP status codes list in text, JSON, or HTML format for APIs, docs, testing, and observability workflows.
Copy common image MIME types in text, JSON, or HTML format for upload validation, image processing, and media tooling.
Copy all 6 native JSON data types from RFC 8259 in text, JSON, or HTML format for quick reference, docs, and dropdown menus.
Copy common video MIME types in text, JSON, or HTML format for upload policies, streaming workflows, and player support checks.