Dad’s Data formats tools

Regex Tester

Test regular expressions with live match highlighting. Runs 100% in your browser.

Pattern
//g
Test string

Three ways flags change a regex

A regular expression is a pattern that matches character sequences. The engine reads your pattern left to right and finds positions in the text where the full pattern applies. The four flags below cover almost every common case — and the difference between global and non-global is the one that surprises people most often.

/g

global

Find all matches, not just the first

/i

ignoreCase

Case-insensitive matching

/m

multiline

^ and $ match line boundaries

/s

dotAll

. matches newlines too

Common pattern building blocks

PatternMatchesExample
.Any character except newline/a.c/ → abc, aXc
\dAny digit (0–9)/\d+/ → 42, 100
\wWord character (letter, digit, _)/\w+/ → hello, foo_1
\sAny whitespace/hello\sworld/ → "hello world"
^ $Start and end of line/^foo$/ → exactly the line "foo"
(group)Capture group — extractable/(\w+)@/ → captures user in email
+ * ?One or more, zero or more, zero or one/colou?r/ → color or colour

Try a regex pattern

Interactive — edit the input to see the output update
pattern: + text: (two lines)
Match Results

Patterns, flags, and gotchas

Your files stay on your computer. Dad promised.

Data formats tools

Search the Data formats tools