Regular expressions (regex) are powerful pattern-matching tools used in programming, text editors, and command-line utilities. Writing correct regex patterns requires testing and iteration. This tool lets you write a regex pattern, apply it to test text, and see matches highlighted in real time. It shows capture groups, supports all JavaScript regex flags (g, i, m, s, u), and provides a quick reference for common patterns.
Enter a regular expression pattern in the top field and paste your test text below. Matches are highlighted in real time as you type. The tool shows capture groups for each match, supports all JavaScript regex flags (g, i, m, s, u), and provides a match count. Use the Replace tab to test search-and-replace operations with capture group backreferences ($1, $2).
Regex testing is used for validating email addresses, phone numbers, and other input formats, extracting data from log files and structured text, building search patterns for code editors and IDEs, writing web scraping patterns, validating and parsing URLs, creating text transformation rules for build tools, and debugging complex patterns for data validation in form inputs.
The tool uses JavaScript's RegExp constructor for pattern compilation, catching syntax errors to provide friendly error messages. Matches are found using String.matchAll() for global matches with capture groups. Highlights are rendered using inline mark elements within a pre-formatted div. The tool supports named capture groups (?<name>...), lookahead (?=...), lookbehind (?<=...), and Unicode property escapes (\p{L}).
A regular expression (regex) is a sequence of characters that defines a search pattern. It is used for string matching, validation, search-and-replace, and text parsing. For example, \d{3}-\d{4} matches phone number patterns like 123-4567.
This tool supports all JavaScript regex flags: g (global - find all matches), i (case-insensitive), m (multiline - ^ and $ match line boundaries), s (dotAll - . matches newlines), u (unicode), and v (unicodeSets).
Parentheses () create capture groups that extract parts of the match. For example, (\d{4})-(\d{2})-(\d{2}) captures year, month, and day separately from a date string. Named groups use (?<name>...) syntax.
* matches zero or more of the preceding element (greedy), while + matches one or more. For example, ab*c matches 'ac', 'abc', and 'abbc', while ab+c matches 'abc' and 'abbc' but not 'ac'.
Compare two texts side by side and highlight the differences line by line.
Test JSONPath expressions against JSON data and view matched results.
Escape strings for JSON and JavaScript. Convert special characters to safe escape sequences like \n, \t, \u00A9.
Transform, format, generate, and encode data instantly. Private, fast, and always free.
Browse All Tools