liveBook · Manning

Character class

A character class is a regular-expression construct that matches one character belonging to, or excluded from, a specified set, range, or property.

How 9 Manning books explain it

Tiny Python Projects: Learn coding and testing with puzzles and games

A character class is a regular-expression construct that matches one character from a specified set or range.

How it is used
Uses character classes to find, replace, extract, and validate constrained text with Python regular expressions.
How deep it goes
Explains listed characters, ranges, negation, quantifiers, anchors, and capture-group combinations through runnable examples.
Examples
Demonstrates vowel replacement, consonant detection, word transformation, placeholder extraction, password cleaning, and board validation.
What you can do after
Apply it via Python's re module to express character sets, exclude characters, and combine classes with broader patterns.

Read how Tiny Python Projects: Learn coding and testing with puzzles and games explains character class →

Secrets of the JavaScript Ninja, Second Edition

A regular expression construct in square brackets that matches one character from a specified set or range, optionally negated.

How it is used
Selects one character from a set or range when a literal character is too restrictive.
How deep it goes
Defines explicit, negated, and ranged classes, then works through a newline-matching idiom without an exhaustive regex treatment.
Examples
Uses `[abc]`, `[^abc]`, `[a-m]`, and assertions comparing `/.*/` with `/[\S\s]*/` on a string containing a newline.
What you can do after
Apply it via JavaScript regular expressions to choose characters from sets and match across newlines.

Read how Secrets of the JavaScript Ninja, Second Edition explains character class →

The Quick Python Book, Fourth Edition

A character class is a regular-expression construct that matches one character from a specified set or range.

How it is used
Selects allowable characters within Python regex patterns, including case variants and name components in contact records.
How deep it goes
Defines single-character matching, ranges, and literal-hyphen placement, then applies repetition; leaves broader regex subtleties to Python’s documentation.
Examples
Uses `[hH]ello`, letter and digit ranges, and hyphenated names in a name-and-phone-number pattern.
What you can do after
Apply it via Python `re` to choose permitted characters in patterns while recognizing that a broad class can match unwanted strings.

Read how The Quick Python Book, Fourth Edition explains character class →

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

A character class is a regular-expression construct that matches a character selected from, or excluded by, a specified set or range.

How it is used
Filters Windows event-log and text-file content by requiring characters to belong to selected categories or ranges.
How deep it goes
Demonstrates \w, \W, combined classes, numeric ranges, and a practical PowerShell pattern without developing regex internals.
Examples
Uses computer-account names in Windows security events and log lines containing mixed word, nonword, and numeric characters.
What you can do after
Apply it via PowerShell Select-String to locate log messages whose characters meet practical account-name or log-text constraints.

Read how Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS explains character class →

Natural Language Processing in Action, Second Edition

A regular-expression construct that matches one character from a specified set or range.

How it is used
Supports precise pattern-based intent recognition for commands and greetings.
How deep it goes
Defines ranges and repetition, then demonstrates combined classes in runnable greeting patterns without covering regex internals.
Examples
Uses lowercase-letter ranges, greeting strings, whitespace and punctuation classes, and captured names in Python.
What you can do after
Apply it via Python's re package to match character ranges and assemble greeting-recognition patterns.

Read how Natural Language Processing in Action, Second Edition explains character class →

Modern C, Third Edition

A character class is a set of characters sharing a property such as being alphabetic, numeric, whitespace, or punctuation.

How it is used
Classifies characters for string processing, case conversion, numeric conversion, and formatted input.
How deep it goes
Defines common predicates, locale extensions, integer interfaces, and scan-set syntax, then demonstrates classifier-based conversion.
Examples
Uses ctype predicates, a hexadecimal-style converter, and scanf sets for vowels and newline-delimited input.
What you can do after
Apply character classes via <ctype.h> classifiers, case conversions, conversion routines, and scanf scan sets.

Read how Modern C, Third Edition explains character class →

Modern C

A character class is a set of characters sharing a property such as being alphabetic, numeric, or whitespace.

How it is used
Supports encoding-independent character inspection, case conversion, string processing, numeric conversion, and formatted input.
How deep it goes
Defines standard classifiers, relationships, locale extensions, and scan-set syntax, but defers wider multibyte-character treatment.
Examples
Uses hexatridecimal conversion, vowel scanning, and whole-line scanning with a negated newline class.
What you can do after
Apply ctype.h classifiers and scanf scan sets to recognize, convert, and selectively read characters.

Read how Modern C explains character class →

The Well-Grounded Rubyist, Fourth Edition

The word character class is the regular-expression character class matching letters, numbers, and underscore.

How it is used
Constrains regular-expression matches and scans word-like text without accepting every character.
How deep it goes
Explains explicit, ranged, negated, predefined, and POSIX classes, including single-character matching and Unicode behavior.
Examples
Uses rejected, hexadecimal strings, digit scans, proper names, Unicode letters, and Greek characters as matching examples.
What you can do after
Apply it via Ruby regular expressions to recognize constrained characters, scan word-like runs, and choose Unicode-aware alternatives.

Read how The Well-Grounded Rubyist, Fourth Edition explains character class →

Python How-To

A character class is a regular-expression shorthand or bracketed construct that matches characters sharing a specified property or membership condition.

How it is used
Builds regular-expression patterns that select characters by property, explicit membership, range, or exclusion.
How deep it goes
Explains shorthand, ranges, combinations, complements, and bracket syntax with matching output, while deferring broader pattern operators.
Examples
Uses [lmn], [a-z], [^a], \d, \D, \s, \S, \w, and \W against short test strings.
What you can do after
Apply it via regular-expression search and find-all functions to locate selected characters in strings.

Read how Python How-To explains character class →

Related concepts

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.