What is the difference between greedy and lazy quantifiers?+
Greedy quantifiers (*, +, ?) match as much as possible. Lazy quantifiers (*?, +?, ??) match as little as possible. On the string '<b>bold</b>', the pattern <.*> greedily matches the entire string from the first < to the last >. The lazy pattern <.*?> matches just '<b>' - the minimum needed to satisfy the pattern.
What is a lookahead and how is it used?+
A lookahead asserts that a pattern must (positive: (?=...)) or must not (negative: (?!...)) immediately follow the current position, without consuming characters in the match. For example, \d+(?= dollars) matches numbers only when followed by ' dollars', without including ' dollars' in the captured match.
What regex flavour does JavaScript use?+
JavaScript uses its own ECMAScript regex engine. Modern JS regex supports: named capture groups (?<name>...) from ES2018, lookbehind (?<=...) and (?<!...) from ES2018, the dotAll flag (s) from ES2018, and the Unicode flag (u) for full Unicode support. Python's re module uses PCRE with minor differences - the Regex Tester here lets you switch flavour.
How do I match whole words in a regex?+
Use word boundary anchors: \bcat\b matches 'cat' as a standalone word but not 'catch' or 'concatenate'. \b matches between a word character (\w: letter, digit, underscore) and a non-word character, or at the start/end of the string. This is equivalent to enabling 'whole word' matching in code editors.