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 texts or files side by side or unified, with word and character highlighting, ignore whitespace or case, collapse unchanged, and .diff export.
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.
ASCII Table
Full ASCII table for all 128 codes with decimal, hex, octal and binary values, character names and descriptions. Search by code, hex or character.
Aspect Ratio Box Generator
Generate CSS for a responsive aspect-ratio container. Use the modern aspect-ratio property or the padding-top fallback, then copy the ready code.
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.