Regular expression literal
A regular expression literal is source-language syntax that directly represents a regular expression pattern, often with optional flags or modifiers.
The Well-Grounded Rubyist, Fourth Edition
A regexp literal is Ruby syntax that directly represents a regular expression between delimiters, optionally followed by modifiers.
- How it is used
- Creates Regexp objects inline for testing, locating, and extracting patterns from strings.
- How deep it goes
- Explains slash and percent delimiters, matching results, and modifiers, but defers exhaustive regular-expression syntax.
- Examples
- Uses /abc/, %r{} and %r(abc)i, multiline phone-number patterns, and collections-report extraction exercises.
- What you can do after
- Apply it via Ruby to test strings, obtain match positions or MatchData, and format complex patterns with modifiers.
Read how The Well-Grounded Rubyist, Fourth Edition explains regular expression literal →
Secrets of the JavaScript Ninja, Second Edition
JavaScript source syntax that specifies a regular-expression pattern between slash delimiters, optionally followed by flags.
- How it is used
- Specifies a regular-expression pattern known at development time for JavaScript matching.
- How deep it goes
- Defines slash delimiters and trailing flags, then tests recognition and basic matching; it does not offer an exhaustive regex tutorial.
- Examples
- Uses /test/, /test/g, /hello/, and patterns with character sets, groups, and backreferences in recognition and matching exercises.
- What you can do after
- Practice/perform identifying literals, recognizing flags, and predicting matches for basic patterns.
Read how Secrets of the JavaScript Ninja, Second Edition explains regular expression literal →
Related concepts
- regular expressionproduces · A formal pattern notation that describes sets of strings and enables text to be matched, searched, extracted, or transformed.
- JavaScriptused by · JavaScript is a high-level, dynamically typed, multi-paradigm programming language standardized as ECMAScript and used for web and general-purpose programming.
- string literalcontrasts with · A string literal is source-code notation that directly represents a string value.
- code compilationuses · Code compilation is the translation of source code or another formal representation into an executable, intermediate, or lower-level representation.
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.

