Skip to content

Regex tester

Test your regular expressions in real time, with matches highlighted and capture groups listed.

/
/

Regex syntax error: {{ regexError }}

Results

{{ matches.length }} match(es) 0 matches
Enter a regular expression above to see the results.
Match {{ index + 1 }}
{{ match }}

What is a regular expression (regex)?

A Regex (Regular Expression) is a sequence of characters that forms a search pattern. Developers use it in JavaScript, PHP, Python or Java to search for, validate or replace specific elements in a text string.

The most famous use case is checking an email address: making sure it contains an "@" followed by a domain and an extension.

Regex cheat sheet: the essentials

  • \d : A digit (0 to 9).
  • \w : An alphanumeric character (letter, digit or underscore).
  • \s : A whitespace character (space, tab).
  • ^ : The start of the string.
  • $ : The end of the string.
  • [a-z] : Any lowercase letter.
  • + : One or more occurrences.
  • * : Zero or more occurrences.

What do the "flags" (modifiers) mean?

Modifiers (or flags) go at the end of the regex (after the last slash) to change its behavior:

  • g (Global) : Without this flag, the regex stops at the first match found. With "g", it extracts all matches in the text.
  • i (Insensitive) : Makes the search case-insensitive (uppercase and lowercase letters are treated the same).
  • m (Multiline) : Means the symbols ^ and $ apply to the start and end of each line of the text, not of the whole text.

More dev tools:

How it works

How to use the regex tester

Test your regex in real time, with matches highlighted and captured groups shown.

  1. Write the regex

    Enter the pattern and the flags (g, i, m…).

  2. Paste your content

    Add the test text.

  3. Analyze

    Matches and groups are displayed.

FreeNo subscription, no hidden limits.
No sign-upOpen the page and use the tool. That’s it.
InstantResults in seconds, on mobile too.
PrivateEverything runs in your browser.

About the regex tester

Regular expressions validate an email address, extract data or run bulk replacements. The tester uses the browser’s JavaScript engine.

regex tester regex online regular expression tester test regex javascript regex tester regex match highlighter regex capture groups
FAQ

Frequently asked questions about the regex tester

Which regex engine is used?

The JavaScript (ECMAScript) one, which is close to PCRE for the most part.

What are the g, i and m flags for?

g: all occurrences. i: case-insensitive. m: ^ and $ match per line.

How do I capture part of the text?

With parentheses ( ), or (?<name> ) for a named group.

Is my text sent anywhere?

No. Everything runs locally.

Esc
↑ ↓ navigateEnter open