liveBook · Manning

Whitespace character

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

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.2 section 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.

Also explained in

Compare how 3 books explain whitespace 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.