Regular expression
A regular expression is a formal pattern notation that describes sets of strings and specifies how text can be matched, searched, or transformed.
Regular Expression Puzzles and AI Coding Assistants
A pattern notation and matching language for describing sets of strings and locating or transforming text that conforms to those patterns.
- How it is used
- Uses patterns to match, validate, extract, and transform text, then probes whether candidate solutions satisfy exact requirements.
- How deep it goes
- Works through quantifiers, anchors, lookahead, backreferences, edge cases, and catastrophic backtracking rather than offering an exhaustive syntax reference.
- Examples
- Uses x…y words, telomere sequences, message protocols, domino plays, signal art, poker hands, and substring counting.
- What you can do after
- Evaluate/understand regex solutions by testing boundaries, overlap, malformed inputs, and performance rather than accepting plausible output.
Read how Regular Expression Puzzles and AI Coding Assistants explains regular expression →
Natural Language Processing in Action, Second Edition
A regular expression is a formal pattern notation for matching and extracting strings that satisfy specified character or sequence constraints.
- How it is used
- Uses regular expressions for chatbot intent recognition, sentence segmentation, and information extraction.
- How deep it goes
- Works through Python patterns and their limitations while leaving finite state machine theory and mathematics largely unexplored.
- Examples
- Demonstrates greeting recognition, sentence splitting, and GPS coordinate extraction from map URLs and prose.
- What you can do after
- Apply regular expressions with Python's re module to match greetings, split sentences, and extract coordinate candidates.
Read how Natural Language Processing in Action, Second Edition explains regular expression →
Secrets of the JavaScript Ninja, Third Edition
A pattern notation used to match and manipulate text.
- How it is used
- Uses patterns to test strings, extract information, and transform matching text instead of writing longer parsing logic.
- How deep it goes
- Works through syntax, captures, replacement, assertions, and backtracking, while leaving patterns unsuitable for regex to a full parser.
- Examples
- Compares ZIP code validation with a loop and demonstrates global extraction, case conversion, number formatting, and slow rejection.
- What you can do after
- Apply it via JavaScript RegExp and string methods to validate, extract, or replace text while recognizing costly patterns.
Read how Secrets of the JavaScript Ninja, Third Edition explains regular expression →
Tiny Python Projects: Learn coding and testing with puzzles and games
A regular expression is a pattern notation for matching and extracting text according to specified character and sequence rules.
- How it is used
- Uses declarative patterns to find, validate, split, extract, and replace text in Python programs.
- How deep it goes
- Descends from character classes and quantifiers to captures, greediness, substitution, and compiled patterns, while leaving advanced regex usage unexplored.
- Examples
- Uses rhyming words, word scrambling, Mad Libs placeholders, ASCII-word cleaning, workout ranges, and Tic-Tac-Toe boards.
- What you can do after
- Apply it via Python’s re module to find, capture, validate, split, clean, and replace structured text.
The Well-Grounded Rubyist, Fourth Edition
Regexp is Ruby's built-in class for representing regular expressions and providing operations for constructing and manipulating them.
- How it is used
- Supports matching, locating, capturing, filtering, and changing text through Ruby pattern-matching operations.
- How deep it goes
- Works from literals and match results through pattern components, captures, MatchData, interpolation, and escaping, without pursuing regexp string notation in depth.
- Examples
- Uses short matching expressions, a comma-separated name-and-title record, and an interpolated dot to expose different matching behaviors.
- What you can do after
- Apply it via Ruby’s matching and string methods to test patterns, extract captures, and escape literal input.
Read how The Well-Grounded Rubyist, Fourth Edition explains regular expression →
Python How-To
A regular expression pattern is a textual specification describing character sequences and structural conditions to be matched in text.
- How it is used
- Uses regular expressions for advanced string processing, including splitting on multiple separators and extracting valid records from noisy text.
- How deep it goes
- Explains pattern syntax, Python operations, and an iterative workflow for creating and testing matches against task data.
- Examples
- Uses comma-and-underscore splitting, digit and boundary searches, and task-record extraction from crash-recovered data.
- What you can do after
- Apply regular expressions via Python’s re module to search, split, replace, and extract text using tested patterns.
Secrets of the JavaScript Ninja, Second Edition
A pattern for matching character sequences in text.
- How it is used
- Simplifies JavaScript text checks, extraction, replacement, and browser-facing matching tasks.
- How deep it goes
- Explains syntax, flags, creation, compilation, and selected pitfalls through examples, without attempting an exhaustive regex tutorial.
- Examples
- Uses a ZIP-code-shaped check, newline-containing HTML, escaped CSS-selector identifiers, and element class-name searches.
- What you can do after
- Apply it via JavaScript regex literals or RegExp to check, capture, and replace text while accounting for compilation and matching pitfalls.
Read how Secrets of the JavaScript Ninja, Second Edition explains regular expression →
Learn AI Data Engineering
A regular expression is a pattern language for matching, extracting, or replacing text according to specified character and sequence rules.
- How it is used
- Transforms inconsistent text into structured fields for DataFrames, JSON, APIs, and log-processing pipelines.
- How deep it goes
- Demonstrates matching, capture groups, substitution, and Python re implementations, while deferring difficult cases to specialized libraries.
- Examples
- Uses U.S. phone numbers, brewery phone and URL fields, product descriptions, logs, addresses, and subscription codes.
- What you can do after
- Apply it via Python re and pandas to extract, normalize, and structure text while validating edge cases.
Read how Learn AI Data Engineering explains regular expression →
The Quick Python Book, Fourth Edition
A regular expression is a formal pattern notation for matching and processing text strings.
- How it is used
- Uses regexes for flexible text parsing when literal substring searches are insufficient.
- How deep it goes
- Explains pattern syntax, searching, escaping, and substitution through examples, while deferring the complete special-character reference to Python documentation.
- Examples
- Counts lines containing hello and compares approaches to validating and normalizing phone numbers.
- What you can do after
- Apply it via Python's re module to search text and substitute matches, testing both positive and negative cases.
Read how The Quick Python Book, Fourth Edition explains regular expression →
Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS
A regular expression is a pattern notation for matching and processing text according to specified character sequences.
- How it is used
- Applies text patterns to filter, search, and extract information from logs and other administrative text files.
- How deep it goes
- Explains core syntax and PowerShell operators with runnable examples, but stops short of comprehensive regex complexity.
- Examples
- Uses character-pattern tests, HTTP error searches, browser-agent searches, event logs, update logs, module data, and IPv4 entries.
- What you can do after
- Apply regexes via PowerShell -Match and Select-String to test patterns and produce filtered administrative reports.
JavaScript in Depth
A pattern language for matching and manipulating text by describing character and sequence constraints.
- How it is used
- Uses patterns to match, search, and manipulate text while exposing Unicode pitfalls in JavaScript strings.
- How deep it goes
- Works through UTF-16 surrogate-pair matching and the `u` flag, but defers detailed regular-expression coverage.
- Examples
- Compares emoji matches with and without `u`, then tests an emoji range and Unicode property escapes.
- What you can do after
- Apply it via JavaScript regex literals with `u` to avoid splitting surrogate pairs in Unicode patterns.
Learn Go with Pocket-Sized Projects
A regular expression is a pattern notation for matching and extracting text according to specified character and sequence rules.
- How it is used
- Uses pattern matching to test randomized HTTP handler output without asserting one specific generated identifier.
- How deep it goes
- Defines character classes, captures, and submatch extraction through one JSON example, but does not develop regexp syntax broadly.
- Examples
- Demonstrates extracting an alphanumeric ID from JSON and validating generated IDs with regexp assertions.
- What you can do after
- Diagnose and test variable text by matching patterns, extracting captures, and normalizing randomized values before comparison.
Read how Learn Go with Pocket-Sized Projects explains regular expression →
Effective Data Analysis
A regular expression is a pattern notation for searching, matching, and extracting text according to specified character or structural criteria.
- How it is used
- Cleans forecast data retrieved through APIs or web scraping before analysis and aggregation.
- How deep it goes
- Defines pattern matching and demonstrates numeric extraction, but does not develop regular-expression syntax beyond these weather examples.
- Examples
- Uses forecast temperatures, sustained wind-speed ranges, mph labels, and API or HTML weather records.
- What you can do after
- Apply it via Python’s re library to extract numeric values and produce analysis-ready dataframe columns.
Read how Effective Data Analysis explains regular expression →
Practical Automation with PowerShell: Effective scripting from the console to the cloud
A regular expression is a notation for describing sets of strings and matching text against those descriptions.
- How it is used
- Sanitizes site-request titles into URL-safe strings and extracts KB identifiers during web scraping.
- How deep it goes
- Breaks down character classes and negation for replacement, then applies a fixed KB pattern without developing broader regex syntax.
- Examples
- Uses URL cleanup for SharePoint site requests and KB-number extraction from Microsoft Update Catalog link text.
- What you can do after
- Apply it via PowerShell regex methods to remove disallowed URL characters and extract structured KB identifiers.
Pandas Workout: 200 exercises to make you a stronger data analyst
A regular expression is a pattern notation for describing and matching sets of text strings.
- How it is used
- Uses regular expressions to search, classify, and filter textual values in pandas Series.
- How deep it goes
- Explains character classes, anchors, word characters, Boolean masks, and preprocessing, but stops short of a general regex syntax survey.
- Examples
- Demonstrates matching words containing vowels and counting capitalized words after removing surrounding punctuation.
- What you can do after
- Apply it via pandas str.contains to build text filters and count values matching explicit patterns.
Logs and Telemetry
A regular expression is a pattern language for matching and extracting text according to specified character sequences.
- How it is used
- Routes and extracts log events for filtering, notification, tenant identification, and parser-driven ingestion.
- How deep it goes
- Explains tag matching, parser failures, performance, and maintenance risks, but does not develop regex syntax systematically.
- Examples
- Uses Fluent Bit tag patterns, dummy inputs, JSON output, and deliberately malformed Nginx-style log records.
- What you can do after
- Apply regex in Fluent Bit configurations while testing malformed input and weighing performance and maintenance costs.
LLM Evaluation and Alignment, The Foundational Ideas
A regular expression is a pattern language for matching, extracting, or validating character sequences in text.
- How it is used
- Extracts answers from variable free-form model responses during evaluation.
- How deep it goes
- Defines regex as a traditional extraction method and diagnoses brittleness, but provides no implementation details.
- Examples
- Shows numerical extraction from explanatory calculations and chain-of-thought responses.
- What you can do after
- Diagnose why regex-based answer extraction can capture intermediate values instead of intended final answers.
Read how LLM Evaluation and Alignment, The Foundational Ideas explains regular expression →
Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI
A pattern notation for matching, extracting, or transforming text sequences.
- How it is used
- Extracts structured machine-learning features from semi-structured rental-listing descriptions.
- How deep it goes
- Defines pattern matching and demonstrates practical extraction, but does not develop regex syntax comprehensively.
- Examples
- Uses Tokyo rental strings to extract area, ratings, bedrooms, beds, baths, and accommodation characteristics.
- What you can do after
- Apply it via Python and pandas to transform text descriptions into numeric, categorical, and binary features.
Building Web APIs with ASP.NET Core
A regular expression is a formal pattern notation for matching strings that satisfy specified character and sequencing rules.
- How it is used
- Validates constrained string inputs in ASP.NET Core request parameters.
- How deep it goes
- Defines patterns and shows attribute-based matching, but treats regular expressions only to a basic extent.
- Examples
- Uses ASC|DESC to validate a board-game API sortOrder parameter.
- What you can do after
- Apply it via the RegularExpression attribute to validate whether endpoint input matches an allowed pattern.
Read how Building Web APIs with ASP.NET Core explains regular expression →
Build Financial Software with Generative AI (From Scratch)
A regular expression is a pattern notation for matching and manipulating text according to specified character and repetition rules.
- How it is used
- Applies pattern matching to email validation and step-argument parsing in developer workflows.
- How deep it goes
- Shows generated validation and named captures, but stops short of teaching regex syntax or matching-engine internals.
- Examples
- Uses a Perl email-validation one-liner and regex-based ACH filename capture in step definitions.
- What you can do after
- Evaluate generated regex code, validate an email example, and simplify captured-string parsing when direct parsing is clearer.
Read how Build Financial Software with Generative AI (From Scratch) explains regular expression →
Vibe Engineering
A regular expression is a pattern notation for matching and extracting text according to specified character and sequence rules.
- How it is used
- Uses regular expressions for secure text parsing and feature extraction, while validating generated implementations with analysis and data review.
- How deep it goes
- Explains backtracking and nested quantifiers with timings, then stops short of a complete regular-expression syntax tutorial.
- Examples
- Uses bold-delimiter patterns, adversarial asterisk strings, medicine dosage fields, notebook output, and missed extraction cases.
- What you can do after
- Diagnose regex performance risks and evaluate extraction quality with linting, timing tests, coverage counts, and record inspection.
Spring Security in Action, Second Edition
A regular expression is a pattern notation for matching character sequences and strings according to specified textual rules.
- How it is used
- Applies fine-grained endpoint authorization when path expressions cannot capture the required request format.
- How deep it goes
- Demonstrates matcher configuration and request outcomes, while deferring comprehensive regex syntax and recommending further study.
- Examples
- Uses email-domain filtering and country-language video authorization with curl requests and Java security configuration.
- What you can do after
- Apply regex authorization through Spring Security request matchers and test allowed or rejected endpoint requests.
Read how Spring Security in Action, Second Edition explains regular expression →
Deep Learning with R, Third Edition
A regular expression is a pattern notation for matching and manipulating sequences of characters.
- How it is used
- Uses regular expressions to split text into character- or word-level tokens for numeric text representations.
- How deep it goes
- Defines flexible pattern matching and demonstrates \\S, but defers systematic regex instruction to external references.
- Examples
- Demonstrates splitting a sentence into characters, words, punctuation, and vocabulary indices.
- What you can do after
- Apply it via stringr to retain non-whitespace tokens and punctuation while splitting text.
Read how Deep Learning with R, Third Edition explains regular expression →
100 C++ Mistakes and How to Avoid Them
A regular expression is a formal pattern specification for recognizing, extracting, or substituting portions of text.
- How it is used
- Simplifies text parsing by specifying patterns for matching text, including email-address checks.
- How deep it goes
- Explains state-machine matching and pattern components, then demonstrates email checks without developing a full parser.
- Examples
- Contrasts a buggy handcoded email check with a regular-expression check and shows raw-string syntax.
- What you can do after
- Apply std::regex_search to check text against an email-address pattern.
Read how 100 C++ Mistakes and How to Avoid Them explains regular expression →
BDD in Action, Second Edition
A regular expression is a pattern notation for matching and extracting text according to specified character and repetition rules.
- How it is used
- Matches and extracts parameters from Cucumber scenarios when implementing automated acceptance-test step definitions.
- How deep it goes
- Explains anchors, capture groups, wildcards, character classes, alternatives, optional characters, and non-capturing groups with examples.
- Examples
- Uses frequent-flyer statuses, point totals, pronoun variants, registration wording, and ISO-formatted dates.
- What you can do after
- Apply regular expressions to implement reusable Cucumber step definitions with constrained and captured parameters.
Read how BDD in Action, Second Edition explains regular expression →
Data Analysis with LLMs
A regular expression is a pattern notation for matching and extracting substrings from text.
- How it is used
- Extracts structured table or SQL content from language-model responses and searches tagged image filenames.
- How deep it goes
- Demonstrates pattern matching, re.findall, and re.DOTALL, but leaves missing-match robustness as a follow-up concern.
- Examples
- Uses table markers, SQL code fences, multiline queries, and tagged image filenames as concrete matching targets.
- What you can do after
- Apply it via Python's re.findall and re.DOTALL to extract marked content before parsing rows, cells, or queries.
Read how Data Analysis with LLMs explains regular expression →
Deep Learning with Python, Third Edition
A pattern language for matching and manipulating character sequences in text.
- How it is used
- Supports text preprocessing by splitting strings into character, word, and punctuation tokens before modeling.
- How deep it goes
- Explains matching patterns through working splitting examples, then stops before detailed regex syntax or engine internals.
- Examples
- Uses character matching, word-and-punctuation matching, and the sentence “The quick brown fox jumped over the dog.”
- What you can do after
- Apply via a regex library to split strings into character or word tokens for subsequent numeric indexing.
Read how Deep Learning with Python, Third Edition explains regular expression →
Build a Reasoning Model (From Scratch)
A pattern-matching technique for searching and extracting text using formal expression syntax.
- How it is used
- Extracts numeric answer candidates from model responses when boxed-answer parsing finds no usable result.
- How deep it goes
- Defines regex as pattern search and applies one numeric pattern, without explaining regex syntax in detail.
- Examples
- Demonstrates fractions, boxed candidates, missing boxes, whitespace, punctuation, and final-number selection.
- What you can do after
- Apply it via Python’s re library to find numeric fallback candidates in generated answer text.
Read how Build a Reasoning Model (From Scratch) explains regular expression →
Julia as a Second Language
A regular expression is a pattern language for specifying text sequences to search for or match.
- How it is used
- Uses pattern matching to search Julia strings and make precise text substitutions.
- How deep it goes
- Defines basic character classes and quantifiers, then demonstrates positional and named captures while leaving broader syntax to documentation.
- Examples
- Uses a Rocket-to-SpaceCraft substitution, character-pattern examples, and extraction of captured text and time fields.
- What you can do after
- Apply Julia Regex literals with `replace` and `match` to target text, perform substitutions, and retrieve captured values.
Read how Julia as a Second Language explains regular expression →
.NET in Action, Second Edition
A regular expression is a pattern language for matching and processing text according to specified character sequences.
- How it is used
- Adds optional -x/--regex matching to command-line file search, replacing string.Contains for line searches.
- How deep it goes
- Identifies the .NET Regex class and IgnoreCase option, but does not explain pattern syntax or matching internals.
- Examples
- Uses [a-z]+ as a Regex pattern and recommends IgnoreCase for command-line searching.
- What you can do after
- Apply .NET Regex to search file lines using regular expressions and IgnoreCase.
Read how .NET in Action, Second Edition explains regular expression →
Kotlin in Action, 2E
A regular expression is a pattern language for matching, searching, or transforming text according to character and repetition rules.
- How it is used
- Applies pattern matching to split strings and parse structured path names.
- How deep it goes
- Explains wildcard matching, escaping, groups, and Kotlin matching calls, but stops short of broader pattern mechanics.
- Examples
- Uses dot-or-dash splitting and directory, filename, and extension extraction from a full path.
- What you can do after
- Apply regular expressions in Kotlin to split strings and extract path components from successful matches.
Grokking Web Application Security
A regular expression is a pattern notation for describing permissible characters and their ordering in text.
- How it is used
- Uses regular expressions to validate web inputs and prevent metacharacters from reaching downstream systems.
- How deep it goes
- Explains pattern validation, sanitization, backtracking, ReDoS, static analysis, and search-index alternatives.
- Examples
- Demonstrates Ruby sanitization, email/date/IP validation, ReDoS scenarios, and Flask searches backed by Elasticsearch.
- What you can do after
- Apply it via validation patterns, keep user-controlled patterns out of server code, and select search indexing for rich queries.
Read how Grokking Web Application Security explains regular expression →
Also covered in
- Go in Practice, Second Edition
- Introduction to Generative AI, Second Edition
- Grokking Statistics
- Go in Action, Second Edition
- The Design of Web APIs, Second Edition
- Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu
- Clojure: The Essential Reference
- Data-Oriented Programming: Reduce software complexity
- Building User-Friendly DSLs
- Build Your Own Robot: Using Python, CRICKIT, and Raspberry Pi
- MongoDB 8.0 in Action, Third Edition
- Outlier Detection in Python
What to know first
- PythonPython is a high-level, general-purpose, dynamically typed programming language with readable syntax and support for multiple programming paradigms.
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- stringA string is a programming-language value representing textual data as an ordered sequence of characters or encoded units.
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
Related concepts
- splitused by · Split is an operation or function that divides a string or sequence into parts according to a separator, pattern, or other rule.
- re.findall()used by · re.findall() is a Python regular-expression function that returns all non-overlapping matches of a pattern in a string.
- cucumber expressionalternative to · A Cucumber expression is a pattern syntax for matching step text and converting parameter placeholders into values for step definitions.
- non-capturing groupuses · A non-capturing group is a parenthesized regular-expression subpattern that groups matching behavior without storing matched text as a capture.
- Select-Stringused by · Select-String is a PowerShell cmdlet that searches text for matches to specified strings or regular-expression patterns.
Questions about regular expression
What is regular expression?
A regular expression is a formal pattern notation that describes sets of strings and specifies how text can be matched, searched, or transformed.
Which Manning books explain regular expression?
Regular Expression Puzzles and AI Coding Assistants, Natural Language Processing in Action, Second Edition, Secrets of the JavaScript Ninja, Third Edition, Tiny Python Projects: Learn coding and testing with puzzles and games, The Well-Grounded Rubyist, Fourth Edition, Python How-To, Secrets of the JavaScript Ninja, Second Edition, Learn AI Data Engineering and 24 more.
What should I know before learning regular expression?
Manning books that teach regular expression usually introduce Python, function, string and language model first.
What is the difference between regular expression and cucumber expression?
A regular expression is a formal pattern notation that describes sets of strings and specifies how text can be matched, searched, or transformed. A Cucumber expression is a pattern syntax for matching step text and converting parameter placeholders into values for step definitions.
What is regular expression also called?
Regular expression is also called regex or RegExp.
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.































