Test regular expressions with live match highlighting, capture group extraction, and common pattern presets. Runs in your browser, nothing sent to a server.
A regular expression (regex) is a pattern that describes a set of strings. Regex is used in search, text validation, parsing, and find and replace operations across virtually every programming language. Enter a pattern and test string below to see matches highlighted in real time, with capture groups and named groups extracted automatically.
A regular expression is a compact syntax for describing patterns in text. Instead of hardcoding a specific string like “hello”, you write a pattern like \b\w+\b that matches any sequence of word characters. Regex is built into virtually every programming language and text editor, making it one of the most portable skills a developer can learn. It is used for input validation (is this a valid email address?), search and replace (swap first and last names), parsing log files, extracting data from structured text, and text processing pipelines. The syntax combines literal characters with metacharacters (., *, +, ?, ^, $) and quantifiers ({n}, {n,m}) to build precise matching rules.
Every regex is built from two kinds of pieces: literal characters that match themselves, and metacharacters that match patterns. The metacharacter \d matches any digit, \w matches any word character (letters, digits, underscore), and \s matches whitespace. Quantifiers control repetition: + means one or more, * means zero or more, {3} means exactly three, and {2,5} means between two and five.
Anchors like ^ (start of string) and $ (end of string) do not consume characters but assert a position. With the multiline flag enabled, they match line boundaries instead. Lookaheads (?=...) and lookbehinds (?<=...) are zero width assertions that check for a pattern without including it in the match.
Character classes [abc] match any one of the listed characters. Ranges like [a-z] match any lowercase letter. Negation [^abc] matches anything except the listed characters.
Certain patterns cause catastrophic backtracking, where the engine takes exponential time on input that does not match. The classic example is (a+)+$ tested against a string of a’s with no line ending. Avoid nested quantifiers on the same characters. If your pattern takes noticeably long, simplify it or use atomic groups/possessive quantifiers (not available in JavaScript regex, but achievable through pattern restructuring).
Need to work with a matched URL? Send it to the URL Encoder for encoding. If a match returns JSON, the JSON Formatter can format it. Use the Diff Checker to compare regex output across different test strings. Quick reference tables for syntax, quantifiers, and lookaheads are in the Regex Cheat Sheet.
Nothing you paste leaves this tab. Every tool runs entirely in your browser — no upload, no server, no account.