Regexp package
regexp is Go’s standard-library package for compiling and matching regular expressions.
Learn Go with Pocket-Sized Projects
regexp is Go's standard-library package for compiling and applying regular expressions.
- How it is used
- Validates generated identifiers in endpoint tests while keeping expected JSON responses deterministic.
- How deep it goes
- Explains compilation, quantifiers, character ranges, capture groups, and match extraction, without covering broader package options.
- Examples
- Uses JSON containing an ID, FindStringSubmatch, strings.Replace, assert.JSONEq, and an alphanumeric ID assertion.
- What you can do after
- Diagnose and test generated string values by compiling patterns, extracting captures, and normalizing nondeterministic output.
Read how Learn Go with Pocket-Sized Projects explains regexp package →
Go in Action, Second Edition
The regexp package is Go's standard-library package for compiling and matching regular expressions.
- How it is used
- Validates configuration fields, sanitizes input, and extracts structured text within a standard-library CLI workflow.
- How deep it goes
- Defines core regex syntax and demonstrates compiled matching for one field, while stopping short of a complete syntax catalog.
- Examples
- Uses metacharacter examples, configuration names, semantic-version strings, hostnames, and a compiled validation listing.
- What you can do after
- Apply compiled regular expressions to validate configuration values and recognize structured text patterns.
Read how Go in Action, Second Edition explains regexp package →
Related concepts
- regular expressionuses · A formal pattern notation that describes sets of strings and enables text to be matched, searched, extracted, or transformed.
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.

