liveBook · Manning

Escape character

As explained in Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS

A backslash is the regular-expression character used to escape characters with special meaning or represent a literal backslash.

In regular expressions, the backslash is the escape character. Place it before a character with special meaning to make that character literal. section 21.2

Matching literal punctuation

The pattern \\. matches a literal period instead of any single character. To match a literal backslash, escape it with another backslash: \\\\. section 21.2

How Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS covers it

How deep it goes
Defines escaping and demonstrates periods and backslashes, while stopping short of broader regex implementation details.
Examples
Demonstrates matching a literal period and matching a literal backslash.
What it assumes
Assumes basic regular-expression syntax and explains escaping through concrete punctuation examples.
What you can do after
Apply it via regular expressions to match characters that would otherwise act as syntax.
How it connects
Connects escaping with regular expressions, special characters, literal characters, quantifiers, and anchors.

Also explained in

Compare how 3 books explain escape character →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS. The section links point to the parts of the book it draws on.