About this tool
This regex tester (regular expression tester, regex practice tool) lets you try a pattern against sample text and see the result right away.
Type a regular expression, paste some text, and every match is highlighted in yellow while a list below shows each match with its position and capture groups.
It uses your browser's own JavaScript regex engine, so what you see is what a JavaScript replace or match call would find.
Tick the flags you need: g finds all matches instead of the first, i ignores upper and lower case, m makes ^ and $ work on each line, s lets the dot match a line break, and u turns on full Unicode handling.
For example, the starting pattern (\d{3})-(\d{4}) finds 555-1234 in a sentence and shows 555 as group 1 and 1234 as group 2. How do I match an email-like word? Try [\w.]+@[\w.]+ and adjust from there.
What does a red message mean? The pattern is not valid, usually an unclosed bracket, a stray backslash or a quantifier with nothing before it. Why was my pattern not run?
To protect your browser, the tester refuses a repeated group inside a repeat, such as (a+)+, which can make matching take forever on some text; rewrite it more simply.
It also limits the pattern to 200 characters, the text to 5,000 and the matches to 500.
Other languages such as Python or PCRE can differ in details like lookbehind or named groups, so test again in your own environment before relying on a pattern.
Everything stays inside this page; your pattern and text are never uploaded or saved. To count characters in your text first, try the character counter.
How to use
- Type your regular expression in the first box.
- Tick the flags you need (g, i, m, s, u).
- Paste or type the test text and look at the yellow highlights.
- Check the match list for positions and capture groups, and fix any red message.