How to use the Regex Tester tool
- Enter the pattern without the surrounding slashes.
- Tick the flags you need and paste your test text.
- Check the highlighted matches and groups. Fill in “Replace with” to preview a replacement.
Flags
- g (global): find all matches, not just the first.
- i: ignore upper and lower case.
- m (multiline): ^ and $ match at every line start and end.
- s (dotAll): the dot also matches newlines.
- u (unicode): full Unicode support, including \p{L} letter classes and emoji.
Patterns worth knowing
^\d{4}-\d{2}-\d{2}$: a date like 2026-10-12.\b\d{1,3}(?:\.\d{1,3}){3}\b: something that looks like an IPv4 address.(?<user>[^@\s]+)@(?<domain>[^@\s]+): a simple email split with named groups.\s+$with the m flag: trailing whitespace on every line.
A word of advice from log parsing: do not try to validate emails or URLs perfectly with one regex. Match loosely, then validate with a real parser or by sending a confirmation email.
Catastrophic backtracking
Some patterns, typically nested quantifiers like (a+)+$, take exponential time on certain inputs. In production this is a real denial-of-service risk (ReDoS) and has taken down large websites. The tester runs each pattern in a background worker and stops it after two seconds, so a bad pattern cannot freeze your browser, and you find out before it reaches your server.
Privacy
Everything runs in your browser. Nothing you type is sent to our server or stored.
Building a pattern step by step
Start with a small piece that matches one example, then extend it one part at a time while watching the highlights. Paste several real lines, including ones that must not match, so you see false positives immediately. Once the pattern works, add anchors (^ and $) or word boundaries (\b) to stop it from matching inside longer text.
Frequently asked questions
Which regex flavour is this?
JavaScript (ECMAScript), as used in browsers and Node.js. Most syntax is shared with Python, Java, .NET and PCRE, but lookbehind, named groups and Unicode classes differ slightly.
How do I use a group in the replacement?
Use $1, $2 for numbered groups, $<name> for named groups, and $& for the whole match.
Why does my pattern match an empty string?
Quantifiers like * allow zero characters. Use + to require at least one.
How do I match a literal dot or bracket?
Escape it with a backslash: \. \[ \( and so on.
Is my text sent anywhere?
No. Matching runs in your browser.
How do I use the pattern in Python?
Most patterns work unchanged with the re module. Named groups are written (?P<name>...) in Python instead of (?<name>...).
