agentmentoragentmentor

Glossary

19 terms from "Regular Expressions: Stop Copy-Pasting Patterns You Can't Read." Look them up when you get stuck; the first mention in the text carries a hover definition.

TermDefinitionSource
regular expressionA pattern used to match combinations of characters inside a string.MDN: Regular expressions (JavaScript Guide)
literalA character in a pattern that matches itself exactly, such as the letters in /cat/.MDN: Regular expressions (JavaScript Guide)
metacharacterA special character that is an instruction rather than a literal, such as . * + ? ^ $ [ ] ( ) or \.MDN: Regular expressions (JavaScript Guide)
character classA set in square brackets that matches exactly one character out of the listed characters, e.g. [abc].regular-expressions.info: Character Classes
rangeA hyphenated shorthand inside a character class for a run of characters, e.g. [a-z] meaning any lowercase letter.MDN: Character classes
negated character classA character class beginning with ^ inside the brackets that matches any single character not in the set, e.g. [^a-z].regular-expressions.info: Character Classes
\dA shorthand character class matching any digit; equivalent to [0-9].MDN: Character classes
\wA shorthand character class matching any word character (a letter, digit, or underscore); equivalent to [A-Za-z0-9_].MDN: Character classes
\sA shorthand character class matching a single whitespace character such as a space, tab, or newline.MDN: Character classes
dot (.)A metacharacter matching any single character except line terminators, unless the s (dotAll) flag is set.MDN: Character classes
quantifierA metacharacter that says how many times the preceding item repeats, such as * (0+), + (1+), ? (0 or 1), {n}, or {n,m}.MDN: Quantifiers
greedyThe default behavior of a quantifier, matching as many repetitions as possible.MDN: Quantifiers
lazy (non-greedy)A quantifier followed by ? that matches as few repetitions as possible, e.g. .+?.MDN: Quantifiers
anchorA zero-width assertion that matches a position rather than a character, such as ^ (start), $ (end), or \b (word boundary).MDN: Assertions (anchors and boundaries)
word boundary (\b)A zero-length anchor matching the position between a word character and a non-word character (or a string edge).regular-expressions.info: Word Boundaries
capturing groupA part of a pattern wrapped in parentheses that both bundles tokens and remembers the text it matched for later extraction.MDN: Groups and backreferences
non-capturing groupA group written (?:...) that bundles tokens without storing what it matched in the result array.MDN: Groups and backreferences
alternation (|)The disjunction operator that matches one of several alternatives and has the lowest precedence in a pattern.MDN: Disjunction (the | operator)
match arrayThe array returned by match without the g flag: index 0 is the whole match and later indices hold the captured groups, plus index and input properties.MDN: String.prototype.match()