How to use the Regex Tester
- 1. Enter your patternType the regex without slashes and tick the flags you need.
- 2. Add test textPaste the text you want to search.
- 3. See the matchesGet highlights, positions and every capture group.
A quick regex example
Say you want to pull email addresses out of some text. Use the pattern (\w+)@(\w+\.\w+) with the g flag on this text:
Write to asha@example.com or ravi@test.orgYou get two matches. For the first one, group 1 is asha and group 2 is example.com. Brackets create groups, and that is how you pull out only the part you need. This is a learning pattern, not a full email validator.
\dmatches a digit and\wa letter, digit or underscore.+means one or more, and*means zero or more.^and$mark the start and end.(?<year>\d{4})makes a named group.
Why slow patterns are stopped
Some patterns can take almost forever on certain text. Nested repeats like (a+)+$ make the regex engine try a huge number of combinations, which is called catastrophic backtracking. On a normal page, that would freeze your tab.
This tester runs your pattern in a separate background worker. If it takes more than 2 seconds, the worker is stopped and you get a clear message, so the page keeps working. It is also useful for spotting these patterns before they reach your server.
This tool uses the JavaScript flavour, so it matches what your browser and Node.js do. Python, PHP and Java differ in some details. Your text stays in your browser. Testing a data file? Clean it first with the JSON formatter, or encode a pattern for a link with the URL encoder.
Frequently asked questions
Which regex flavour is this?
JavaScript. Results match browsers and Node.js. Other languages support similar syntax but differ in some features.
What do the flags do?
g finds all matches, i ignores case, m lets ^ and $ work on each line, s lets the dot match line breaks, and u turns on full Unicode.
Why was my pattern stopped?
It took more than 2 seconds, which usually means nested repeats are backtracking. Try making the repeated part more specific.
Is this tool free?
Yes, it is free. We ask for your name and WhatsApp number once when you see your result, and other Uncodemy tools then open without the form.