🔍 Developer Tools
Regex Tester
Test regular expressions with real-time matching, highlighted results, capture groups, and match positions.
How the Regex Tester works
Type a regex pattern in the Pattern field — no need for delimiters like /pattern/, just the pattern itself. Choose flags to control matching behavior (most commonly g for all matches and i for case-insensitive). Enter your test text, then click Test Match. The tool uses JavaScript's RegExp engine to find all matches, then displays them highlighted in context along with their positions and any capture groups.
Frequently Asked Questions
What is a regular expression (regex)?
A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. Regex is used for string matching, validation (like emails or phone numbers), find-and-replace operations, and data extraction in programming, text editors, and command-line tools.
What do regex flags mean?
Regex flags modify how the pattern matching behaves:
g (global) — finds all matches instead of stopping at the first.
i (case-insensitive) — ignores letter case.
m (multiline) — makes ^ and $ match the start/end of each line.
s (dotall) — makes the dot (.) match newline characters.
u (unicode) — enables proper Unicode matching.
y (sticky) — matches only from the exact
g (global) — finds all matches instead of stopping at the first.
i (case-insensitive) — ignores letter case.
m (multiline) — makes ^ and $ match the start/end of each line.
s (dotall) — makes the dot (.) match newline characters.
u (unicode) — enables proper Unicode matching.
y (sticky) — matches only from the exact
lastIndex position.
How do I test a regex pattern online?
Enter your regex pattern in the Pattern field (without delimiters like
/pattern/), select any flags you need, then type or paste your test text. Matches are shown in real-time with highlighting, match count, positions, and capture group details.
What are capture groups in regex?
Capture groups are parts of a regex pattern enclosed in parentheses
( ). They let you extract specific portions of a match. For example, in the pattern (\d{3})-(\d{4}), the first group captures a 3-digit area code and the second captures a 4-digit number. Each group is numbered starting from 1, with group 0 being the full match.
What are the most common regex patterns?
Common regex building blocks include:
\d — any digit (0-9)
\w — any word character (a-z, A-Z, 0-9, _)
\s — any whitespace character
. — any character except newline
* — zero or more of the preceding element
+ — one or more
? — zero or one (makes preceding element optional)
^ — start of string or line
$ — end of string or line
[abc] — character set (matches a, b, or c)
(ab|cd) — alternation (matches ab or cd)
\d — any digit (0-9)
\w — any word character (a-z, A-Z, 0-9, _)
\s — any whitespace character
. — any character except newline
* — zero or more of the preceding element
+ — one or more
? — zero or one (makes preceding element optional)
^ — start of string or line
$ — end of string or line
[abc] — character set (matches a, b, or c)
(ab|cd) — alternation (matches ab or cd)