Free tool ยท TextForge

Regex Tester

Type a regular expression and paste your test string to see matches highlighted in real time. Inspect capture groups and match positions. Runs entirely in your browser โ€” nothing is sent to any server.

/ /
0 characters
โ€”
Matches
โ€”
Unique
โ€”
Groups
0
Characters

Need regex find-and-replace directly in your browser on any text you're working with? TextForge runs as a Chrome extension โ€” paste text, apply regex, extract or transform results, all locally.

Try TextForge โ€” free

Quick Patterns

Click any pattern to load it into the tester above. Then paste your own text to see it in action.

Regex Quick Reference

A condensed reference for the most-used regular expression syntax. All patterns in this tester follow JavaScript's ECMAScript regex engine.

TokenMeaningExample
.Any character except newline (add s flag to match newlines)c.t โ†’ "cat", "cut"
\dAny digit 0โ€“9\d\d\d โ†’ "404"
\wWord character [a-zA-Z0-9_]\w+ โ†’ "hello_world"
\sWhitespace (space, tab, newline)\s+ โ†’ gaps between words
\bWord boundary\bcat\b matches "cat" not "catch"
^Start of string (or line with m flag)^\d โ†’ line starting with a digit
$End of string (or line with m flag)\d$ โ†’ line ending with a digit
*0 or more (greedy)ab* โ†’ "a", "ab", "abbb"
+1 or more (greedy)ab+ โ†’ "ab", "abbb" (not "a")
?0 or 1 (optional)colou?r โ†’ "color" or "colour"
{n,m}Between n and m times\d{2,4} โ†’ 2 to 4 digits
[abc]Character class (any of a, b, c)[aeiou] โ†’ any vowel
[^abc]Negated class (anything except a, b, c)[^\d] โ†’ non-digit
(abc)Capture group โ€” stored as $1, $2โ€ฆ(\d{4})-(\d{2}) โ†’ two groups
(?:abc)Non-capturing group(?:foo|bar)baz
a|bAlternation (a or b)cat|dog
*? +?Lazy quantifier (shortest match)<.+?> matches first tag only

Flags

FlagNameEffect
gGlobalFind all matches, not just the first
iCase insensitiveHello matches "hello", "HELLO", "HeLLo"
mMultiline^ and $ match start/end of each line, not just the whole string
sDot-all. matches newline characters too