Regex Tester Online: Test and Debug Regular Expressions
How to test regular expressions online with real-time match highlighting, use regex flags correctly, read capture groups, and apply common patterns.
Last updated: May 4, 2026
What is a regex tester online?
A regex tester (short for regular expression tester) lets you write a pattern and immediately see which parts of your test text it matches — with match highlighting, capture group values, and the start and end position of each match. Testing in a dedicated tool is far faster than the trial-and-error loop of editing code, running it, and checking output.
JavaScript regex syntax is supported, which covers the vast majority of server-side use cases as well: Node.js, Python (with minor differences), Go, Ruby, and Java all share the same core syntax for the most common operations.
Regex flags reference
| Flag | Name | Effect |
|---|---|---|
| g | global | Find all matches, not just the first one |
| i | ignoreCase | Match uppercase and lowercase interchangeably |
| m | multiline | ^ and $ match start/end of each line, not just the string |
| s | dotAll | . matches newline characters in addition to all others |
| u | unicode | Enable full Unicode matching and \ p{} category escapes |
| y | sticky | Match only from lastIndex — like g but without advancing past misses |
Essential metacharacter reference
| Token | Matches |
|---|---|
| . | Any character except newline |
| \d | Digit [0-9] |
| \D | Non-digit |
| \w | Word character [a-zA-Z0-9_] |
| \W | Non-word character |
| \s | Whitespace (space, tab, newline) |
| \S | Non-whitespace |
| \b | Word boundary |
| ^ | Start of string (or line with m) |
| $ | End of string (or line with m) |
| * | 0 or more (greedy) |
| + | 1 or more (greedy) |
| ? | 0 or 1 (optional) |
| {n} | Exactly n times |
| {n,m} | Between n and m times |
| [abc] | Character class: a, b, or c |
| [^abc] | Negated class: anything except a, b, c |
| (x) | Capturing group |
| (?:x) | Non-capturing group |
| x|y | x or y (alternation) |
6 practical regex patterns
\b[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Z|a-z]{2,}\b[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])^[a-z0-9]+(?:-[a-z0-9]+)*$#(?:[0-9a-fA-F]{3}){1,2}\bUnderstanding capture groups
Capture groups let you extract specific parts of a match. Any part of a pattern wrapped in parentheses () is a capture group. Groups are numbered left to right starting at $1.
Pattern
(\w+)@(\w+\.\w+)Test text: alice@example.com
Full match: alice@example.com
$1 (username): alice
$2 (domain): example.com
Use (?:) (non-capturing group) when you need to group tokens for quantifiers but do not need the value — for example (?:https?://)?\w+ makes the protocol optional without creating a capture group for it.
Common regex mistakes
Without the global flag, the regex engine stops after the first match. If you expect multiple matches, always add g.
Quantifiers like .* are greedy — they match as much as possible. Use .*? (lazy) to match as little as possible, especially inside HTML or JSON strings.
In a regex, . matches any character. To match a literal dot in example.com, write example\.com.
^ and $ match the start and end of the entire string by default. Add the m flag if you want them to match the start and end of each line.
Frequently asked questions
The tester uses the JavaScript RegExp engine built into your browser. This covers the ECMAScript regex specification including all standard flags and syntax.
Yes. JavaScript supports positive and negative lookaheads ((?=x) and (?!x)) and lookbehinds ((?<=x) and (?<!x)) in modern browsers.
Python uses the re module which has minor syntax differences from JavaScript: \A and \Z for string anchors, (?P<name>) for named groups, and slightly different Unicode support. For cross-language testing, prefer \d \w \s and character classes which work consistently.
.* matches zero or more characters (including none), while .+ requires at least one character. Use .+ when you need at least one character to be present.
No. All matching runs client-side in your browser using the native JavaScript RegExp API. Nothing is transmitted.