Sign up free

Online Regex Tester and Checker

Write a pattern, paste some text, and watch matches, groups and replacements update live.

About Regex Tester

This regex tester shows what a regular expression really matches before you put it in code, a spreadsheet formula or a find-and-replace dialog. Type the pattern between the slashes, paste test text below, and every match is highlighted as you type, with a running count. If you only need emails, links or phone numbers, Extract Emails, Links and Numbers finds them without writing a pattern.

The Matches and groups list shows each match with its numbered groups ($1, $2) and named groups, and Replace with previews a substitution on the whole text. Flags g, i, m, s and u are one click each, and hovering over them shows what they do. The engine is the one in your browser, so patterns behave exactly as in JavaScript. Invalid patterns show the error message at once.

How to use Regex Tester

  1. 1
    Enter the pattern

    Type the regex between the slashes, without the slashes themselves.

  2. 2
    Set the flags

    g and u are on by default. Add i, m or s as needed.

  3. 3
    Paste test text

    Paste text or open a file, and the regex tester highlights every match.

  4. 4
    Check groups and replace

    Read the groups in Matches and groups, and try a replacement with $1.

Why use Cubfile for this

  • Live highlighting

    Matches light up in the text as you type the pattern.

  • Groups laid out

    Numbered and named groups for up to 300 matches, in a readable list.

  • Replacement preview

    See the whole text after replacing, with $1-style references.

  • JavaScript flavor

    Lookbehind, named groups and Unicode property escapes work as in modern browsers.

FAQ

Regex Tester: questions and answers

Which regex flavor does the regex tester use?
JavaScript, as built into your browser. Most syntax is shared with Python, Java and PCRE, but PCRE extras such as possessive quantifiers and atomic groups aren't available.
Why does the regex tester find only one match?
The g flag is probably off. With g ticked every match is found, and without it only the first.
What do the m and s flags do?
m makes ^ and $ match at the start and end of each line instead of the whole text. s lets the dot match line breaks too.
Can I test regex replacements with $1 and named groups?
Yes. Type into Replace with, using $1, $2 or $<name> for groups, and the full result appears below. For several replacements in a row, use Find and Replace Text, which runs its rules from top to bottom.
Is my test text uploaded?
No. Matching runs in your browser, so logs and customer data stay on your device, with no daily limit. A draft stays in this browser until you delete the text.
Share Regex Tester with a friendIt runs in any browser, and they can try it without signing up.

Related tools

JSON JSON FormatterFormat, validate and minify JSON, errors pointed out by line.
TXT Text CleanerRemove extra spaces, empty lines and broken line breaks in one click.
TXT Text CompareCompare two texts side by side and see every change.
TXT Word CounterCount words, characters, Chinese characters, lines and reading time live.
TXT Base64 Encode and DecodeEncode and decode Base64 text and files.
AaTXT Case ConverterUPPER, lower, Title, Sentence, camelCase, snake_case and more.
TXT Find and Replace TextReplace words in text in bulk, with regular expressions if you need them.
TXT Password GeneratorMake strong random passwords on your device.