Regex Decoder
Paste a Regular Expression to understand what it does.
Test it
What this tool does
The Regex Decoder explains a regular expression piece by piece in plain English, tells you if it isn't valid, and lets you test it on your own text with every match highlighted.
How to use it
- Type or paste a pattern, without the surrounding slashes (
\d+, not/\d+/), or click an example. - Read the explanation. Cards inside a group are indented, so you can see what belongs together.
- Choose flags and type some text under Test it to see what matches, with each capture group listed.
The building blocks
- Characters: letters and digits match themselves.
.matches any character;\da digit,\wa letter, digit or underscore,\swhitespace. Put a backslash before a special character to match it literally:\. - Sets:
[aeiou]matches one of those characters,[a-z]one in a range,[^0-9]anything except a digit. - Quantifiers:
*0 or more,+1 or more,?optional,{3}exactly 3,{2,5}2 to 5. They repeat only the single item just before them: inabc+, only the c repeats. Add?to make one lazy (as few as possible). - Anchors:
^the start and$the end of the text;\ba word boundary. - Groups:
( )groups and saves what it matches,(?: )only groups,(?<name> )saves it under a name.|means OR. - Lookarounds:
(?= )and(?! )check what comes next;(?<= )and(?<! )check what came before, without including it in the match.
Flags
- g finds every match, not just the first.
- i ignores upper and lower case.
- m makes
^and$work on each line. - s lets
.match line breaks too. - u handles emoji and other Unicode characters properly and allows
\p{...}.
A walkthrough: the Date example
Click Date (named groups). The pattern (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) reads like this:
(?<year>starts a group named "year" that saves what it matches.\d{4}matches exactly four digits, such as 2026, and)closes the group.-matches a hyphen.- The month and day groups do the same with two digits each.
In the test text "Due 2026-10-04, paid 2026-12-31." it finds two dates and lists the year, month and day of each. It would also accept 2026-99-99: a regex checks the shape of text, not whether a date exists, so check the values in your own code.
Frequently asked questions
Which regex flavor is this?
JavaScript's. Most of the basics work the same in Python, PHP, Java and others, but details differ, so test in the language you'll use.
Can a regex check an email address properly?
Only roughly. The email example checks for "something @ something . something" and accepts long endings like .photography. The only real test is sending an email.
Why did the page freeze?
Some patterns, especially nested repeats like (a+)+, can take an enormous number of steps on certain text. Simplify the pattern if that happens.
Sources: MDN Web Docs, Regular expressions guide and syntax cheat sheet; ECMAScript Language Specification, RegExp. Last reviewed on SuiteWebTools: October 2026.