🔤

Regex Tester — Live Match Highlight, Groups, Replace, Unit Tests

Real-time · 26 features · AI explain · Unit tests · Diff mode · JS/Python/PHP · 100% browser

REGEX PATTERN
//g
FLAGS
TEST TEXT
0 matches
 
Ctrl+L ClearCtrl+S DownloadCtrl+Shift+C Copy matchesP PinF Fullscreen

What is a Regular Expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. Used for validation, parsing, text manipulation, and data extraction in virtually every programming language — JavaScript, Python, PHP, Java, and more.

How to Use This Regex Tester

Type your regex pattern in the input field. Matches highlight in real-time in the test text panel. Use the flags (g/i/m/s/u/y) to modify matching behavior. Switch between Test, Replace, Unit Test, Diff, and Multi-string modes using the tabs above.

Frequently Asked Questions

What is a regular expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. Used for string matching, validation, parsing, and text manipulation in virtually every programming language.

What do the regex flags mean?

g = global (find all matches), i = case-insensitive, m = multiline (^ and $ match line start/end), s = dotAll (. matches newline), u = unicode mode, y = sticky (match from lastIndex position).

What is a capture group?

Parentheses () create a capture group. The content matched inside is captured and accessible as group 1, 2, etc. Named groups use (?<name>...) syntax and are accessible by name.

What is the difference between greedy and lazy matching?

Greedy (default): .* matches as much as possible. Lazy: .*? matches as little as possible. Add ? after a quantifier to make it lazy: +?, *?, {n,m}?.

How do lookaheads work?

Lookaheads assert what follows without consuming characters. (?=x) positive: position must be followed by x. (?!x) negative: position must NOT be followed by x. Lookbehind (?<=x) and (?<!x) work the same way but look behind.

What is the difference between test() and match() in JavaScript?

regex.test(str) returns true/false. str.match(regex) returns an array of matches (or null). str.matchAll(regex) returns an iterator of all matches with groups. str.replace(regex, replacement) replaces matches.

You might also like

Related Tools