Regex Tester and Match Highlighter
Type a regular expression and some text to see every match highlighted instantly, with numbered and named capture groups. Toggle flags and try a replacement, all in your browser.
How to test a regular expression
- Enter your pattern and pick flags like g for all matches or i to ignore case.
- Paste the text you want to search into the test box.
- Read the highlighted matches and capture groups, or add a replacement to preview the output.
Examples
Find all numbers
Pattern /\d+/g on "a1b22c333"
3 matches: 1, 22, 333
Capture groups
Pattern /(\w)(\d)/g on "a1b2"
Match a1 with groups a and 1; match b2 with groups b and 2
Frequently asked questions
What do the g, i, m and s flags do?
g finds every match instead of just the first. i ignores case. m makes ^ and $ match at the start and end of each line. s lets the dot match newline characters too.
How do capture groups work?
Parentheses create a capture group. Each match lists its numbered groups in order, and if you use named groups like (?<year>\d{4}) the captured name and value are shown as well.
Why is one of my matches empty?
Patterns that can match nothing, such as a* or (b)?, produce zero-length matches at positions where they apply. That is expected. The tester advances past them so it never gets stuck.
Which regex dialect does this use?
It uses the JavaScript RegExp engine built into your browser. Most features carry over from other languages, but lookbehind, Unicode property escapes and some syntax follow the ECMAScript rules.
Do I include the slashes in the pattern?
No. Type only the pattern source, for example \d+ rather than /\d+/g, and choose the flags separately with the checkboxes.
Is my text and pattern private?
Yes. Everything runs locally in your browser and nothing is uploaded to a server.
Related tools
Diff Checker
Compare two blocks of text or code line by line. See added, removed and unchanged lines with color highlighting. Free, fast and runs in your browser.
Cron Expression Explainer
Paste a cron expression to see what it means in plain English plus the next 5 run times. Works fully in your browser, no signup needed.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.
Base58 Encoder
Encode and decode Base58 online with the Bitcoin alphabet. Convert text to Base58 or back, UTF-8 safe, no confusing 0 O I l. Runs in your browser.
Base64 Decode
Decode Base64 to plain text online. Paste a Base64 or base64url string and get instant UTF-8 output. Free, fast and runs in your browser.