Regex Tester

Regex Tester

Test a JavaScript regular expression against sample text and list every match. Flags are limited to g, i, m, s, u, and y. Nothing is uploaded.

Free
No signup
Instant
Works in your browser

Regex Pattern

Enter your regular expression pattern.

Test String

Enter the text you want to test.

5 lines

Results

3 matches found

The pattern matches 3 out of 5 lines.

invalid-email

No match

Real-time Testing

See matches and groups instantly as you type.

JavaScript RegExp

Uses this browser’s engine, including g, i, m, s, u, and y flags.

Capture Groups

View all captured groups with clear highlighting.

Useful Examples

Try common patterns with one click.

Popular Use Cases

Your data stays private

Patterns and test text stay in your browser. Nothing is uploaded or stored on a server.

Learn more about privacy →

About testing regular expressions in JavaScript

The engine is the same RegExp your browser uses for app code. Patterns follow JavaScript syntax, not POSIX or PCRE-everywhere. Flags are limited to gimsuy. This page tests each line of the haystack on its own so a pattern like ^\w+@\w+\.\w+$ can validate a list of emails without turning on m. Unmatched lines stay visible in red. “No matches” is a successful test with count 0, not a syntax error. Invalid patterns surface the engine error instead of a fake match list.

Use the Examples menu for email, phone, URL, date capture groups, and extra-space cleanup. Capture Groups lists numbered groups from every hit. Explanation walks the pattern token by token (^, \w, +, character classes). Catastrophic backtracking can freeze the tab — keep patterns simple on large haystacks. This is not a replace-all tool; copy matches, then use Find & Replace for literal swaps.

Haystack and pattern never leave the browser. Close the tab to clear them. Related: Find & Replace when you need substitutions, Text Diff when you want a before/after view, JWT Decoder and Cron Builder when the string is a token or a schedule rather than a regex.

How to test a regex

Enter the pattern

Type JavaScript syntax or pick Examples. Email demo: [\w.]+@\w+\.\w+ with one address per line.

Set flags and sample lines

g for every hit on a line, i for ignore-case, m if ^/$ should see inner line breaks in one field. The match list updates as you type.

Read matches, groups, and explanation

Green rows matched; red rows did not. Capture Groups shows $1…$n. Explanation names each token.

Stay on this device

We never upload the haystack. Avoid nested quantifiers on huge inputs. Matches update as you type.

Related tools

Regex Tester FAQ

JavaScript RegExp in this browser, not POSIX or PCRE-everywhere. Flags may only be a combination of g, i, m, s, u, and y. Each line of the test string is tried on its own, so ^ and $ work without m. Uncheck Global (g) to stop after the first hit on a line. Invalid patterns surface the engine error. “No matches” is a successful test with count 0.

Yes. Catastrophic backtracking (nested quantifiers on a long haystack) can lock the page. Keep patterns simple on large text. This is not replace-all; copy matches, then use Find & Replace for literal swaps. Unicode flag u is required for some astral characters.

No. Pattern, flags, and haystack stay in this tab. Close the page to clear them. Nothing is stored on a server.