What you can check
Whether a pattern matches what you expect and nothing else: paste real samples (log lines, emails, product codes) and watch the matches, their positions and capture groups update as you edit the pattern. Toggle the g, i, m, s and u flags, and try a replacement with $1-style references before putting it in your code.
JavaScript syntax, safe to run
The engine is your browser's JavaScript one, so lookbehind, named groups and Unicode property escapes work as in Node.js and modern browsers; PCRE-only features (possessive quantifiers, recursion) don't. A pattern with catastrophic backtracking is run in a separate worker with a time limit, so it is stopped instead of freezing the tab.
Quantifiers: greedy vs lazy
By default, quantifiers are greedy — they match as much text as possible. In "<b>hello</b>", the pattern <.*> matches the whole "<b>hello</b>": .* runs to the last > of the text.
Adding ? makes a quantifier lazy — it matches as little as possible. In the same text, <.*?> matches just "<b>" (it stops at the first >), and a g search then finds "</b>" as a second match. This matters as soon as you pick pieces out of structured text like HTML or JSON.
Character classes
Built-in classes: \d matches any digit (0-9), \w matches word characters (letters, digits, underscore), \s matches whitespace (space, tab, newline). Uppercase versions (\D, \W, \S) match the opposite.
Custom classes use brackets: [a-z] matches lowercase letters, [^0-9] matches anything except digits, [A-Za-z0-9_] is equivalent to \w. Ranges work for consecutive Unicode code points.
Capture groups and backreferences
Parentheses () create capture groups that extract specific parts of a match. In the pattern (\d{4})-(\d{2})-(\d{2}), group 1 captures the year, group 2 the month, group 3 the day.
Non-capturing groups (?:...) group without capturing — useful for applying quantifiers to a group without creating an extra capture. Named groups (?<name>...) make captures more readable in code. A backreference matches the same text again: (\w+) \1 finds a doubled word such as "the the", and in a replacement $1 (or $<name>) inserts what the group captured.
Lookahead and lookbehind
Lookahead (?=...) matches a position followed by a pattern without consuming it. For example, \d+(?= dollars) matches digits only when followed by " dollars". Negative lookahead (?!...) matches when NOT followed by the pattern.
Lookbehind (?<=...) matches a position preceded by a pattern. (?<=\$)\d+ matches digits preceded by $. JavaScript supports both lookahead and lookbehind in modern engines.