Regex Tester
Test regular expressions live with colour-coded match highlighting, capture group extraction, replacement preview and plain-English explanations. Includes a 30+ pattern library for email, URL, date, phone and more.
Regex Tester
Rate this tool
Live highlighting, plain-English explanations and a 30+ pattern library
Most regex testers show a match or no match and stop there. This tester highlights every match in colour directly in the test text, extracts all capture groups individually, previews replacement strings live, explains your pattern in plain English and includes a library of 30+ production-ready common patterns.
How to test a regular expression
Regex syntax cheat sheet
| Token | Matches |
|---|---|
| . | Any character except newline (use s flag to include newline) |
| \d | Any digit 0-9. \D = non-digit |
| \w | Word character [a-zA-Z0-9_]. \W = non-word |
| \s | Whitespace (space, tab, newline). \S = non-whitespace |
| [abc] | Character class: a, b or c |
| [^abc] | Negated class: any character except a, b, c |
| [a-z] | Range: any lowercase letter |
| ^ | Start of string (or line with m flag) |
| $ | End of string (or line with m flag) |
| \b | Word boundary. \B = non-word boundary |
| Token | Meaning |
|---|---|
| * | 0 or more (greedy). *? = lazy |
| + | 1 or more (greedy). +? = lazy |
| ? | 0 or 1 (optional) |
| {n} | Exactly n times |
| {n,m} | Between n and m times |
| (abc) | Capture group 1 |
| (?:abc) | Non-capturing group |
| (?<name>abc) | Named capture group |
| a|b | Alternation: a or b |
| \1 | Back-reference to group 1 |
LazyTools vs other online regex testers
| Feature | ⭐ LazyTools | regex101.com | regexr.com | regexpal.com |
|---|---|---|---|---|
| Live match highlighting | ✔ | ✔ | ✔ | ✔ |
| Capture group extraction | ✔ | ✔ | ✔ | ✘ |
| Replacement preview | ✔ | ✔ | ✔ | ✘ |
| Plain-English explanation | ✔ | ✔ (complex) | Partial | ✘ |
| Common pattern library | ✔ 30+ patterns | Community | Limited | ✘ |
| No login required | ✔ | ✔ | ✔ | ✔ |
| No ads | ✔ | ⚠ Ads | ⚠ Ads | ⚠ Ads |
| Clean focused UI | ✔ | Complex | Moderate | ✔ |
Regex Tester — Complete Guide to Testing Regular Expressions Online
A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. Regex is supported in virtually every programming language — JavaScript, Python, PHP, Ruby, Java, Go, Rust, Swift, Kotlin, C# — and is a fundamental tool for text processing, validation, parsing, extraction and transformation. An online regex tester lets you iterate on a pattern interactively, seeing matches in real time, without needing to write and run code each time.
Regex tester with explanation online free
Most regex testers show you whether your pattern matches, but do not explain why. The Explain tab in this tester breaks down your pattern token by token in plain English. For example, the pattern \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b with the i flag is explained as: word boundary, one or more word characters from the set [A-Z0-9._%+-], a literal @, one or more domain characters, a literal dot, and two or more letters for the TLD, terminated by a word boundary. This explanation makes it possible to understand and modify patterns you did not write yourself.
Test regular expression with match highlighting
The core feature of a regex tester is showing you which parts of your test string were matched. This tester highlights each match directly in the test text using a different background colour for each consecutive match. When the global (g) flag is on, all matches are highlighted simultaneously. When g is off, only the first match is highlighted. The highlighting layer is synchronised pixel-perfect with the text input so matched text appears highlighted exactly where it sits in the string.
Regex tester with capture groups online
Capture groups — created with parentheses in a regex — extract substrings from within a match. Group 1 is the first pair of parentheses, group 2 the second and so on. Named groups (?<year>\d{4}) give a group a reusable name. The Matches panel in this tester lists every match with its position in the string, then shows each capture group below it. If a group did not participate in the match (it was in an optional branch that was not taken), it shows as undefined. This panel makes it easy to verify that your extraction groups are capturing exactly the substrings you intend.
Common regex patterns library
The Library tab includes 30+ production-tested regex patterns for the most common use cases: email address validation, HTTP/HTTPS URL matching, international phone numbers, IPv4 and IPv6 addresses, ISO date formats (YYYY-MM-DD), time formats (HH:MM:SS), hex colour codes, credit card number formats, US and UK postal codes, JWT tokens, UUIDs, HTML tags, slug validation, username validation, password strength rules, US Social Security numbers and more. Click Use next to any pattern to load it into the tester.
Regex tester JavaScript Python
This tester uses JavaScript's native RegExp engine, which implements a subset of the Perl-compatible regex (PCRE) syntax used by most modern languages. JavaScript regex is slightly different from Python's re module in a few ways: JavaScript does not support named back-references with \k<name> in older engines, Python uses (?P<name>) for named groups while JavaScript uses (?<name>), and Python's re.VERBOSE (x) flag (which ignores whitespace) is not available in JavaScript. For patterns tested here and used in Python, replace named group syntax (?<name>) with (?P<name>) and the patterns should work identically in Python's re and regex modules.