Free tool • Runs in your browser
Regex tester
Test JavaScript regular expressions live, with highlighted matches, groups and replace.
Quick answer
Enter a pattern and flags, then add test text. Matches are highlighted as you type, with capture groups listed. It uses your browser's JavaScript engine, so other languages may behave a little differently.
How to use it
- Enter a pattern and flags.
- Add your test text.
- Review the matches, and try a replacement.
Example
Pattern: \d+ Text: Order 12 and 345
2 matches: 12, 345
Common errors and how to fix them
- Invalid regular expression
- Check for unmatched brackets, or escape special characters with a backslash.
- The page froze
- Nested quantifiers such as (a+)+ can run for a very long time. Simplify the pattern.
Frequently asked questions
How do I test a regex online?
Enter a pattern and flags, add test text, and matches are highlighted as you type.
How do I write a regex?
Combine literal characters with symbols such as \d for digits, + for one or more, and [] for sets. Test each step as you build it.
How do I use regex in Python?
Import the re module and use functions such as re.search or re.findall. Syntax can differ slightly from this JavaScript tester.
How do I use regex in JavaScript?
Write a pattern such as /\d+/g, and use it with methods such as match, matchAll or replace.
How do I use regex in Java?
Use the Pattern and Matcher classes, and remember to double backslashes in string literals.
How do I use regex in Excel?
Newer Microsoft 365 versions include functions such as REGEXTEST and REGEXEXTRACT. Availability depends on your version.
How do I use regex in SQL?
It depends on the database. For example, PostgreSQL uses the ~ operator, and MySQL uses REGEXP.
What does the g flag do?
It finds every match instead of stopping after the first.
Why did my regex freeze the page?
Nested quantifiers such as (a+)+ can run for a very long time on some inputs. Simplify the pattern.
Is what I paste uploaded?
No. Everything runs in your browser and nothing is sent to Quecko.
More developer tools
Need something built for your business?
Quecko designs and builds AI, Web3 and custom software products.