Regex Tester
Test a regular expression against a string — shows all matches, captured groups, and highlights matches inline.
Regex example with capturing groups
Pattern and test string:
pattern (\d{4})-(\d{2})-(\d{2})
text Released 2026-03-14, patched 2026-04-02.
The pattern matches twice. Each pair of parentheses captures one group:
match 1 2026-03-14 groups: 2026, 03, 14
match 2 2026-04-02 groups: 2026, 04, 02
The three flags change how the pattern is applied:
- Ignore case lets
errormatchERRORandError. - Multiline makes
^and$match at the start and end of every line, not only of the whole text. - Dot matches newline lets
.match a line break, soa.*bcan span several lines.
Why a pattern matches too much or nothing
- Greedy quantifiers.
<.+>on<b>x</b>matches the whole string, because+takes as much as it can.<.+?>stops at the first>. - Unescaped metacharacters. In
example.comthe dot matches any character, soexampleXcommatches too. Writeexample\.com. - Missing anchors.
\d{3}finds three digits inside12345. Use^\d{3}$to require exactly three digits and nothing else. - Catastrophic backtracking. Nested quantifiers such as
(a+)+$take exponential time on input that almost matches. Avoid a quantifier applied to a group that itself ends in a quantifier. - A different flavour. This tester uses Python syntax. Named groups are
(?P<name>...); JavaScript writes(?<name>...). A pattern that works here can need small changes in another language.
Related tools
Monitor Regex Tester automatically
Test a regular expression against a string — shows all matches, captured groups, and highlights matches inline. NetTests can run this check on a schedule, preserve historical results, compare changes over time, and alert you the moment something breaks.
Start monitoring free → See all monitoring productsFrequently Asked Questions
What does the regex tester do?
It runs your regular expression against the test text and shows every match, the captured groups inside each match, and highlights the matches inline so you can see exactly what your pattern does before using it in code.
Which regex flavor / syntax does it use?
It uses Python's re engine. The syntax is very close to Perl Compatible Regular Expressions (PCRE) and JavaScript regex for everyday patterns, but a few advanced features differ — Python uses (?P<name>…) for named groups and \1 style backreferences. Most patterns you'd write for JavaScript or PHP behave the same here.
What are capturing groups?
Parentheses ( ) create a capturing group — the part of the match they surround is extracted separately. For example (\d{4})-(\d{2}) against 2026-06 captures 2026 and 06 as groups 1 and 2. Use (?:…) for a non-capturing group when you only need grouping for alternation or quantifiers.
What do common regex tokens mean?
\ddigit,\wword char,\swhitespace..any character,*zero-or-more,+one-or-more,?optional.^start,$end,|alternation.[a-z]character class,{2,5}between 2 and 5 repetitions.
Why isn't my pattern matching anything?
The most common causes are an unescaped special character (escape literal dots as \.), a greedy quantifier consuming too much, or a case mismatch. Try simplifying the pattern piece by piece and check whether you need case-insensitive matching.