liveBook · Manning

Nonwhitespace character

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

A nonwhitespace character is a regular-expression character that is not whitespace.

In regular expressions, \S matches any single character that is not whitespace. Because \s matches whitespace—including spaces, tabs, and carriage returns—\S provides the complementary pattern for finding characters outside those categories. section 21.2

Recognizing the pattern

Pattern: \S. Use it when a match must contain a nonwhitespace character rather than a space, tab, or carriage return. 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 \S as the complement of \s without developing regex internals or extended matching procedures.
Examples
Contrasts \S with \s, which matches spaces, tabs, and carriage returns.
What you can do after
Apply it via regular expressions to match characters excluding whitespace.
How it connects
Connects nonwhitespace characters with whitespace, word characters, and regular expressions.

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.