What is Regex Tester & Sandbox?
Regex Tester & Sandbox tests a regular expression against sample text with your choice of flags and lists every match with its position and capture groups.
How It Works
- Enter a regular expression, its flags and the text to test in the input fields on this page.
- Press the button to run Regex Tester & Sandbox.
- Read each match, its position and its capture groups in the result area, and copy or download it.
Common Uses
- Building and debugging a pattern before putting it in code.
- Checking why a validation rule does not match.
- Learning how flags like g, i and m change the result.
Good to Know
It uses your browser's JavaScript regex engine, so the syntax is JavaScript's, which differs slightly from PCRE and Python.
How to use it
Enter a regular expression, choose flags and paste the text to test. The tool lists every match with its start and end position and each capture group. It uses your browser's JavaScript regular-expression engine, so the syntax is JavaScript's.
Worked example
The pattern (\d+)-(\w+) with the g flag on 12-ab 7-z finds two matches: 12-ab at 0-4 with groups 12 and ab, and 7-z at 6-8 with groups 7 and z.
Flags
g finds every match instead of the first, i ignores case, m makes ^ and $ work on each line, s lets the dot match a newline, u turns on Unicode mode and y matches only at the exact position. Test with the same flags you will use in your code.
Frequently Asked Questions
Will the pattern work in Python or PHP?
Not always. Other languages differ in details such as named groups and lookbehind.
Why does it find only one match?
Add the g flag to find all matches.
Is my text uploaded?
No. Matching happens in your browser.
What does Regex Tester & Sandbox do?
Regex Tester & Sandbox tests a regular expression against sample text with your choice of flags and lists every match with its position and capture groups.
What do I need to enter in Regex Tester & Sandbox?
A regular expression, its flags and the text to test.
Is my data private in Regex Tester & Sandbox?
Regex Tester & Sandbox runs in your browser, so what you enter is not uploaded to MyToolDock.
Is MyToolDock Regex Tester & Sandbox free to use?
Yes, MyToolDock Regex Tester & Sandbox is 100% free with no registration, subscriptions, or limits. All features are fully unlocked.