Regex Tester
Write a regular expression, toggle the flags, and see every match against your test text with its position and capture groups.
How it works
The pattern runs through JavaScript's own regular expression engine — the same one your code will use — so what you see here is what you will get in the browser or in Node. Patterns written for other flavours may behave differently.
The global flag is always applied so that every match is listed rather than just the first. Zero-width matches are advanced past deliberately, which stops a pattern like a* from looping forever on text that does not contain an a.
The formula
Flags
i ignore case · m multiline · s dot matches newline · u unicode
Capture group
( … ) captures; (?: … ) groups without capturing
Named group
(?<name> … ) captures under a name
Worked examples
| Scenario | Working | Result |
|---|---|---|
| (\w+)@([\w.]+) | Against an email in text | Match plus two groups: user and domain |
| ^\d{4}-\d{2}-\d{2}$ | With multiline on | Matches a date on each line |
| colou?r | Optional u | Matches both spellings |
When you'd use it
- Checking a validation pattern before shipping it
- Extracting fields from a log line
- Working out why a find-and-replace is missing cases
- Learning what a pattern someone else wrote actually does
Common questions
Why does my pattern work here but not in my language?
Regex flavours differ. This uses JavaScript's engine; PCRE, Python and .NET support features JavaScript lacks — lookbehind support, possessive quantifiers and named-group syntax all vary. Test in the flavour you will ship.
Do I need to escape the slashes?
No. Enter the pattern without the surrounding /…/ delimiters, so a forward slash inside it needs no escaping.
Is my test text uploaded?
No. The expression runs in your browser, which matters when you are testing patterns against real log data.

