Regex Tester Online

/
/

Enter a pattern and test string to start

What Are Regular Expressions?

A regular expression (regex) is a pattern that describes a set of strings. It defines rules — characters to match, repetitions, alternatives, anchors — and the engine checks whether and where the pattern occurs in the input. Once you internalize the syntax, regex becomes one of the most expressive and portable tools in a developer's toolbox.

🔑 Core Syntax

PatternMeaningExample match
.Any character except newlinea, 5, @
\dDigit [0-9]3, 7
\wWord char [a-zA-Z0-9_]a, Z, _
\sWhitespace (space, tab, newline)(space)
^Start of string (or line with m flag)
$End of string (or line with m flag)
*0 or more repetitions (greedy)aaa, (empty)
+1 or more repetitions (greedy)aaa
?0 or 1 repetition (optional)a, (empty)
{n,m}Between n and m repetitionsaa, aaa
(abc)Capture groupabc
(?:abc)Non-capturing groupabc (not captured)
(?<name>abc)Named capture groupgroups.name = abc
[a-z]Character class (range)a, b, z
[^abc]Negated class (not a, b, or c)d, 5, @
a|bAlternation (a or b)a, b

🚩 Flags

🛠️ Common Real-World Patterns

All matching runs locally in your browser using the native JS RegExp engine.

Related Tools