Lambda saysRegular expressions match patterns in strings — for validation, search, and replace.
A regex like /\d+/ describes a pattern (here, one or more digits). Use str.match, test, replace, and split with them. Build literals with slashes or new RegExp(str) for dynamic patterns. Start simple — regex grows cryptic fast, so comment non-trivial ones.
Power-ups you unlock
Patterns: \d digit, \w word, . any, + one-or-more
test() → boolean · match() → results
Literal /pattern/ or new RegExp(str)
Comment non-trivial patterns
The Mutator attacks — common mistakes
Validating email/URLs with a fragile homemade regex
Forgetting to escape special chars in dynamic patterns
Catastrophic backtracking on complex patterns
Boss battleTest whether a string contains digits, then extract them with match.