Whitespace is nonprinting spacing such as spaces, tabs, or carriage returns that separates elements in source text.
A whitespace character is nonprinting spacing, such as a space, tab, or carriage return. In a shell, whitespace can also mark where a variable name ends. section 21.2section 16.9
Whitespace characters help with two practical tasks:
Use the regular-expression pattern \s to match any whitespace character; use \S to match any nonwhitespace character. section 21.2
Recognize spaces, tabs, and carriage returns as boundaries that stop an unbraced shell variable name. section 16.9
Matching whitespace
In a regular expression, \s matches a space, tab, or carriage return, while \S matches a character that is not whitespace. 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 three whitespace forms, shows regex matching, and explains variable-name termination without developing deeper parsing internals.
Examples
Uses the patterns \s and \S, alongside spaces, tabs, and carriage returns as concrete examples.
What you can do after
Evaluate regular-expression patterns and recognize when whitespace ends an unbraced variable name.
How it connects
Connects whitespace characters with regular expressions, shell parsing, and variables.
The Quick Python Book, Fourth EditionWhitespace is non-printing character spacing, such as spaces, tabs, and line breaks, that can separate or structure source code.
trimused by · Trim is a string operation that returns a string or view with specified characters, typically whitespace, removed from its beginning and end.
splitused by · Split is an operation or function that divides a string or sequence into parts according to a separator, pattern, or other rule.
JSXuses · JSX is a JavaScript syntax extension for expressing user-interface elements with XML-like or HTML-like markup that is transformed into JavaScript.
rstripaddressed by · rstrip is a string method that returns a copy with specified trailing characters removed, defaulting to trailing whitespace.
Pythoncontrasts with · Python is a high-level, general-purpose, dynamically typed programming language with readable syntax and automatic memory management.
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.