Got My Tools

Regex Tester

Test a regular expression against sample text and see every match highlighted, live.

2 matches
Contact us at hello@example.com or support@example.org for help.
Match details

Match 1: hello@example.com at index 14

Groups: $1=hello $2=example.com

Match 2: support@example.org at index 35

Groups: $1=support $2=example.org

Uses your browser's native regex engine (JavaScript flavor) — everything stays on your device.

Common patterns to test against

  • Email: [^\s@]+@[^\s@]+\.[^\s@]+
  • Digits only: ^\d+$
  • URL: https?:\/\/[^\s]+
  • Whitespace-trimmed line: ^\s*(.*?)\s*$

Reading a regex piece by piece

Regular expressions read left to right as a sequence of instructions: ^ and $ anchor to the start/end of a line, \d/\w/\s match a digit/word-character/whitespace, +/* mean "one or more"/"zero or more" of whatever came before, and parentheses () capture a group you can reference later. Building a pattern in small pieces and testing each addition against real sample text — exactly what this tool is for — is far more reliable than writing the whole thing at once.

Greedy vs. lazy matching

By default, * and + are "greedy" — they match as much as possible. Adding a ? after them (like *?) makes them "lazy," matching as little as possible instead. This matters most with wildcards like .*, where greedy matching can accidentally span much further than intended across a long string.

Frequently asked questions

Which regex flavor does this use?+

JavaScript's native regex engine (the same one your browser uses) — supports capture groups, named groups, lookaheads/lookbehinds, and all the standard flags.

Why is there no 'g' checkbox?+

The tool always searches for every match so it can highlight all of them, regardless of what flags you pick — the flags shown (i, m, s, u) are the ones that actually change matching behavior.

Is my text sent anywhere?+

No — matching happens entirely in your browser using JavaScript's built-in RegExp.