Home › Regular Expression Tester

Regular Expression Tester

Type a pattern and a test text to see exactly what matches, where, and what each capture group caught, updated as you type.

Results

Matches
2
Invoices: 2025-03-14 and 2025-11-02.
#PositionMatchGroups
1102025-03-142025 | 03 | 14
2252025-11-022025 | 11 | 02

How it works

The pattern is compiled by your browser’s JavaScript regular expression engine with the flags you tick, then run over the test text. Matches are highlighted in the text and listed in a table with their position and groups. A match that is empty is counted but not highlighted, and the loop always advances so a pattern like a* cannot get stuck.

Rules and details

Worked example

The pattern (\d+)-(\d+)-(\d+) on the text “Invoices: 2025-03-14 and 2025-11-02.” finds 2 matches. The first is 2025-03-14, whose groups are 2025 | 03 | 14. The second match starts at position 25, counting from zero.

Frequently asked questions

Why does only the first match appear?

Without the g flag a regular expression stops at the first match. Tick “g: find all matches” to list every one.

Are the results identical in Python, PHP or Java?

Mostly, but not always. Lookbehind support, named group syntax and Unicode behavior differ between engines, so confirm in the target language.

Can a pattern freeze the page?

A badly written pattern with nested repetition, such as (a+)+b, can take exponential time on some inputs. If the page stops responding, simplify the pattern and reload.

Tips

Related tools

All tools