Skip to content
Toolbrik

Regular Expression Tester

Write your regex pattern, pick flags, and see matches highlighted live over your test text, with a list of matches and captured groups.

Expression and flags

/…/g

Test text

Type an expression and a test text to see the matches.

How to use: Regex

  1. 1Type the regular expression and toggle flags (g, i, m, s, u).
  2. 2Paste the test text.
  3. 3Review the highlighted matches and captured groups.

What is it for?

  • Validate emails, phone numbers or postal codes.
  • Test search-and-replace patterns before using them in code.
  • Extract data from logs or long texts.

Regular expressions without surprises

Basic building blocks

\d matches a digit, \w a letter, digit or underscore and \s a whitespace character. The quantifiers *, + and ? mean "zero or more", "one or more" and "optional"; {n,m} sets a range. ^ and $ anchor to the start and end, and parentheses form groups you can capture and reuse.

Greedy versus lazy

By default quantifiers are greedy: they try to match as much as possible. In <.+> applied to "<a><b>" it captures the whole string; with <.+?> it captures each tag separately. Many "it captures too much" bugs are solved with the lazy version or a negated class such as [^>]+.

Flags

g finds all matches, i ignores case, m makes ^ and $ work per line, s lets the dot match line breaks and u enables Unicode mode, needed for emoji and characters outside the basic plane. This tool uses the JavaScript regular expression engine.

Performance and security

Patterns with nested quantifiers such as (a+)+ can cause catastrophic backtracking (ReDoS) on certain inputs and freeze a process. If you validate user text on a server, avoid such constructs and cap the input length.

Related tools

Related articles

Frequently asked questions

Which regex engine does it use?+

The ECMAScript (JavaScript) engine, the same one browsers and Node.js use.

Was "Regex" useful?

Share it with whoever needs it. It's free and stores no data.