Regex Tester

Test regular expressions in real time with match highlighting, capture groups, and position info.

Presets

Pattern
Test String

Regular expression basics

A regular expression (regex) is a pattern that describes a set of strings. They're used everywhere in IT — log parsing, input validation, search-and-replace, firewall rules, and scripting.

Flags explained

g — Global
Find all matches in the string, not just the first one.
i — Case Insensitive
Match uppercase and lowercase letters interchangeably. /abc/i matches "ABC", "abc", and "AbC".
m — Multiline
Makes ^ and $ match the start and end of each line, not just the entire string.

Common patterns

Pattern Meaning
.Any character except newline
\dAny digit (0–9)
\wWord character (a–z, A–Z, 0–9, _)
\sWhitespace (space, tab, newline)
^Start of string (or line with m flag)
$End of string (or line with m flag)
*Zero or more of the preceding element
+One or more of the preceding element
?Zero or one of the preceding element
{n,m}Between n and m of the preceding element
[abc]Any one of a, b, or c
[^abc]Any character except a, b, or c
(group)Capture group — extracts matched content
a|bEither a or b

Capture groups

Parentheses () create capture groups that extract portions of a match. For example, the pattern (\d4)-(\d2)-(\d2) against "2026-03-10" produces three groups: "2026", "03", and "10". Groups are numbered left-to-right starting at 1.

Performance note

Some patterns with nested quantifiers like (a+)+ can cause catastrophic backtracking, where the regex engine takes exponentially longer as the input grows. This tester includes a 2-second timeout to prevent browser freezes. If you hit the timeout, try simplifying nested repetition or using atomic groups.