What are regular expressions?
Regular expressions are a miniature language for describing patterns of text. A single pattern can match phone numbers, extract email addresses, validate ISO dates, or split a log line into fields. Every major programming language, database, and text editor supports them — the syntax differs in details but the core concepts are universal: character classes, quantifiers, grouping, alternation, anchors, and backreferences.
Flavor: JavaScript (ECMAScript)
This tester uses your browser's native regex engine — the same one JavaScript code on every website uses. It supports all modern flags:
g— global, find every match instead of just the firsti— case-insensitivem— multiline, so^and$match line starts and endss— dotAll, lets.match newlinesu— unicode, enables\p{…}property escapesy— sticky, matches only fromlastIndex
Common pitfalls
Greedy vs lazy. By default .* is greedy — it matches as much as possible. Use .*? for lazy (match as little as possible). Greedy quantifiers inside HTML parsing are a classic source of over-matching bugs.
Anchor escaping. Inside a character class, ^ means "not" only as the first character: [^abc]. Elsewhere it means start-of-string/line. $ inside a class is literal.
Catastrophic backtracking. Patterns like (a+)+b can take exponential time on non-matching inputs. If your regex hangs the browser, simplify the nested quantifiers or rewrite with an atomic-group equivalent.
