Regex Tester.
Test a regular expression against your own text and see every match with its position. Uses the PCRE engine (as in PHP) with i, m and s flags and ready-made examples.
PCRE, the PHP flavour.
Patterns here run through PCRE, the same library PHP’s preg_ functions use. Most everyday syntax behaves identically in JavaScript and Python, but a few features differ. The notes below list the ones that trip people up most.
Processed on our server. What you enter is sent over an encrypted connection, calculated, and returned. It is never written to a database or logged, and nothing is retained once the result is sent. Avoid entering passwords, API keys or other secrets. How we handle data
What you see
As you type, the tester reports whether the pattern compiles, how many matches it finds, and lists the first 20 matches with the character offset where each one starts. An invalid pattern shows the engine’s error message instead.
Flags
i ignores case. m makes ^ and $ match at every line break rather than only at the start and end of the text. s lets the dot match newlines too. The tester always finds every match, so the g flag is effectively on.
Testing Regular Expressions: A Practical Guide Methodology.
The Calculation Branch
Industrial Standards.
Your pattern is wrapped in delimiters and run with PHP's preg_match_all, which uses the PCRE2 library. Any forward slashes in your pattern are escaped for you, so you can type the pattern exactly as you would in most languages. The selected flags are appended as modifiers. If the pattern fails to compile, or exceeds PCRE's backtracking limit, the error is reported instead of a result. Up to the first 20 matches are listed with their byte offset in the text.
In-Depth Analysis & Reference Data
Start with the examples. The quick-example buttons load working patterns for email addresses, URLs, digits and IPv4 addresses, each with sample text. Change one piece at a time and watch how the match list responds; it is the fastest way to learn what each token does.
Greedy versus lazy. Quantifiers such as * and + are greedy: they match as much as possible. Against the text <b>one</b> <b>two</b>, the pattern <b>.*</b> returns one long match covering both tags. Adding a question mark, <b>.*?</b>, makes it lazy and returns two separate matches. This one change fixes a large share of regex bugs.
Anchors matter for validation. The pattern \d{5} will find five digits inside 123456789. If you want to check that a whole field is exactly five digits, anchor it: ^\d{5}$. Forgetting anchors is the most common reason a validator accepts input it should reject.
Where engines differ. PCRE, JavaScript and Python agree on character classes, quantifiers, groups, alternation and lookahead. Differences to watch: JavaScript only gained lookbehind in ES2018 and older browsers lack it; PCRE requires lookbehind to be fixed-length, while JavaScript allows variable length; named groups are written (?P<name>...) in Python but (?<name>...) in JavaScript, and PCRE accepts both; possessive quantifiers such as a++ and atomic groups exist in PCRE but not in JavaScript.
Catastrophic backtracking. Nested quantifiers like (a+)+$ can take exponential time on input that almost matches. PCRE stops after a set number of steps and this tester reports that as an error. If you see it, rewrite the pattern so that each character can only be matched one way.
Frequently asked questions.
Will a pattern that works here work in JavaScript?
Usually, yes. Standard syntax is shared. Check the differences listed above if your pattern uses lookbehind, named groups, possessive quantifiers or atomic groups, and remember that in JavaScript you need the g flag to find more than the first match.
Does it show capture groups?
Not separately. The tester lists each full match and its position. To check a group, temporarily make the group the whole pattern, or wrap the parts you care about in lookarounds so only they are matched.
Why does my pattern show an error about a limit?
That is PCRE stopping a pattern that backtracks too much, usually because of nested quantifiers such as (a+)+ or (.*)*. Make the inner part more specific, or use a lazy or possessive quantifier, and the error will go away.
Estimates for planning. Always confirm against an authoritative source.