Escape sequence
An escape sequence is source notation using a marker to change how following characters are interpreted, often representing a special character or control value or making syntax literal.
Modern C
An escape sequence is a C source notation beginning with a backslash that encodes a character or special value.
- How it is used
- Uses escapes to format output and specify characters that may be inconvenient to enter directly.
- How deep it goes
- Explains tab, newline, and four- and eight-digit Unicode forms without providing an exhaustive escape reference.
- Examples
- Illustrates escapes with formatted numerical output, the character ä, and graphical bar and corner macros.
- What you can do after
- Apply escape sequences in C string literals to format output and specify Unicode code points.
Modern C, Third Edition
An escape sequence is source-code notation beginning with a backslash that encodes a character or special value.
- How it is used
- Uses escapes to specify Unicode characters and control characters in C string literals.
- How deep it goes
- Explains four- and eight-digit Unicode forms and identifies tab and newline escapes, without cataloging other escape forms.
- Examples
- Uses an ä literal, drawing-character macros, and a printf call containing tab and newline escapes.
- What you can do after
- Evaluate and understand Unicode and output escapes in C string literals, distinguishing them from printf format specifiers.
The Well-Grounded Rubyist, Fourth Edition
Character escaping is syntax that represents special characters or prevents characters from being interpreted as delimiters or interpolation markers.
- How it is used
- Controls literal characters and syntax interpretation in Ruby strings and regular expressions.
- How deep it goes
- Works through quoting, heredocs, regexp metacharacters, and dynamically constructed patterns, including the two parsing layers of Regexp.new.
- Examples
- Contrasts newline and tab output across quotation styles, then tests whether an interpolated dot matches a literal dot or any character.
- What you can do after
- Apply it via Regexp.escape to match interpolated text literally, and write string escapes that survive passage to Regexp.new.
Read how The Well-Grounded Rubyist, Fourth Edition explains escape sequence →
100 Java Mistakes and How to Avoid Them
An escape sequence is a backslash-initiated notation in a string or character literal that represents a special character or character value.
- How it is used
- Prevents malformed Java literals and regex patterns caused by treating backslashes as ordinary characters.
- How deep it goes
- Explains common escapes, silent literal changes, regex double interpretation, and path-based prevention.
- Examples
- Uses Windows paths, regex word boundaries, IDE highlighting, and Path.of as concrete examples.
- What you can do after
- Diagnose silently altered literals and construct paths or regex patterns with the required escaping.
Read how 100 Java Mistakes and How to Avoid Them explains escape sequence →
Learn Rust in a Month of Lunches
An escape sequence is a character sequence in a string literal that represents a special character or encoding instruction.
- How it is used
- Uses escape sequences to control printed line breaks, tabs, quotation marks, backslashes, and Unicode characters.
- How deep it goes
- Explains common escapes, Unicode notation, raw-string alternatives, and delimiter adjustments, while stopping short of broader string formatting.
- Examples
- Shows newlines, tabs, escaped quotes, file paths, raw strings, hashtags, byte strings, and Unicode escapes.
- What you can do after
- Apply it via Rust string literals to represent special characters and choose raw strings when escaping becomes cumbersome.
Read how Learn Rust in a Month of Lunches explains escape sequence →
The Quick Python Book, Fourth Edition
An escape sequence is a character sequence in a string literal that represents a character or control function using a backslash-based notation.
- How it is used
- Represents special characters and control functions inside Python string literals.
- How deep it goes
- Defines basic, numeric, and Unicode forms, then explains regex double interpretation; it defers broader Unicode-system details.
- Examples
- Uses newlines, tabs, quotes, backslashes, ASCII codes, Unicode names, and regex patterns as concrete examples.
- What you can do after
- Apply escape sequences to write strings containing control characters, quotes, backslashes, ASCII characters, and Unicode characters.
Read how The Quick Python Book, Fourth Edition explains escape sequence →
Also covered in
- Python Concurrency with asyncio
- Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS
- Grokking Web Application Security
- Learn Go with Pocket-Sized Projects
- How Computers Make Books
- Julia as a Second Language
- .NET in Action, Second Edition
- Python How-To
- Type-Driven Development with Idris
- Go in Action, Second Edition
What to know first
- string literalA string literal is a fixed sequence of text characters written directly in a programming or data-language expression as a string value, rather than computed from other data.
- stringA string is a programming-language value representing textual data as an ordered sequence of characters or encoded units.
- ASCIIASCII is a 7-bit character-encoding standard that assigns numeric codes to 128 basic Latin characters, symbols, punctuation marks, digits, and control characters.
- PythonPython is a high-level, general-purpose, dynamically typed programming language with readable syntax and support for multiple programming paradigms.
Related concepts
- backslashuses · A backslash is the character \ commonly used in programming and text syntaxes to introduce an escape sequence or alter the interpretation of a following character.
- autoescape tagcontrasts with · An autoescape tag is a template directive that controls whether interpolated content is automatically escaped before rendering.
- character literaluses · A character literal is source-code notation that directly denotes a single character value.
- f-stringused by · An f-string is a Python formatted string literal that evaluates embedded expressions and inserts their formatted values into the resulting string.
Questions about escape sequence
What is escape sequence?
An escape sequence is source notation using a marker to change how following characters are interpreted, often representing a special character or control value or making syntax literal.
Which Manning books explain escape sequence?
Modern C, Modern C, Third Edition, The Well-Grounded Rubyist, Fourth Edition, 100 Java Mistakes and How to Avoid Them, Learn Rust in a Month of Lunches and The Quick Python Book, Fourth Edition.
What should I know before learning escape sequence?
Manning books that teach escape sequence usually introduce string literal, string, ASCII and Python first.
What is the difference between escape sequence and autoescape tag?
An escape sequence is source notation using a marker to change how following characters are interpreted, often representing a special character or control value or making syntax literal. An autoescape tag is a template directive that controls whether interpolated content is automatically escaped before rendering.
What kinds of escape sequence are there?
Kinds of escape sequence include hexadecimal escape sequence.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.





