한국어
Home › Developer › Regex Tester

Regex Tester

Type a JavaScript regular expression and see every match highlighted instantly. Includes a capture group table, a replace preview and a set of common patterns.

//

Capture groups

Common patterns

Load one and adjust it to your data. These are starting points, not perfect validators.

How to use

1Enter a patternType the regex between the slashes and the flags on the right. You can also toggle flags with the checkboxes.
2Add textPaste the text you want to test. Matches are highlighted in color right away.
3Check groups and replaceSee capture group values in the table, then check the replaced result and copy it.

When it helps

A regular expression is a short rule for finding or replacing text that follows a certain shape. Regex is powerful, but a single wrong character can change the result completely, so it pays to try it on real data before putting it in your code.

This tool uses your browser's own JavaScript regex engine, so the results match what you get in front-end code or Node.js. Named groups, Unicode property escapes (\p{...}) and lookbehind work too, as long as your browser supports them.

For everyday jobs such as masking phone numbers, pulling dates out of logs or finding email addresses, load a pattern from the list and start from there. The text you enter is never sent anywhere.

FAQ

Which regex flavor does this use?

JavaScript (ECMAScript). It is mostly the same as Python, Java and PHP, but some features such as possessive quantifiers and conditional patterns are not supported.

What happens if I turn off the g flag?

Only the first match is found, and only the first match is replaced. Keep g on to find all matches.

How do I match a US phone number?

Load the US phone number pattern from the list. It accepts formats like 555-123-4567, (555) 123-4567 and 555.123.4567. Adjust it if you also need country codes.

My browser froze.

Patterns like (a+)+ can explode in cost on certain inputs. With very long text, only the first 1,000 matches are highlighted. It is best to avoid nested repetition.

Is an email regex enough to validate addresses?

It only checks that the address looks right. A regex cannot tell whether the address really exists, so you still need a confirmation email.