/

Regex Tester

Processed Client Side

Test regular expressions against a string with live match highlighting. See every match numbered, with its position in the text.

Test string · 3 lines
//gi
Flags:
Length: 185Lines: 3Size: 185 BytesCursor: 1:1
Matches
3 matches
Preview
Contact us at support@example.com or sales@company.io.
You can also reach john.doe+tag@sub.domain.co.uk for billing questions.
Invalid: @nodomain, noatsign.com, missing@, double@@at.com
#1support@example.com14–33
#2sales@company.io37–53
#3john.doe+tag@sub.domain.co.uk74–103

Bookmark this tool now — skip the search next time you need it.

About Regex Tester

This tool runs entirely in your browser. Whatever you paste is processed on your own device and is never uploaded, logged, or sent to any server.

Build a regular expression and test it against real text with live highlighting, so you can see what your pattern actually matches instead of guessing. Every match is highlighted in the preview and listed underneath with its position in the string, numbered in order, so overlapping intent and greedy quantifiers become obvious immediately. All five JavaScript flags are one click away, an invalid pattern is reported as you type rather than silently matching nothing, and each match can be copied individually or all at once. It uses the browser regular expression engine, so what works here works identically in your JavaScript, Node, or TypeScript code.

Key features

  • Live match highlighting inside the test string as you edit the pattern
  • Numbered match list with the start and end index of every match
  • All five JavaScript flags as toggles: g global, i case-insensitive, m multiline, s dot-all, u unicode
  • Invalid patterns are flagged immediately with a clear error state, rather than quietly matching nothing
  • Live match count, so you can tell "no matches" apart from "pattern is broken"
  • Copy any single match, or copy all matches as a newline-separated list
  • Uses the native browser regex engine — identical semantics to JavaScript and Node
  • Runs entirely client-side, so you can test patterns against production log lines safely

How to use it

  1. Type your regular expression into the pattern field — without the surrounding slashes.
  2. Toggle the flags you need; g is what you want whenever you expect more than one match.
  3. Paste your test string into the pane below.
  4. Read the highlighted preview and the numbered match list with positions.
  5. Adjust the pattern until the highlighting matches your intent, then copy the matches or the pattern.

Tips & common mistakes

  • Without the g flag you only ever get the first match. If your pattern looks right but only one result appears, that is why.
  • Quantifiers are greedy by default: .* runs to the last possible match on the line. Add a question mark to make it lazy — .*? — when scraping between delimiters.
  • Use m when ^ and $ should mean start and end of each line rather than of the whole string. Use s when you need . to cross newlines.
  • Anchor with \b word boundaries instead of spaces when matching whole words, so a match at the start or end of the string is not missed.
  • Escape the dot. An unescaped . matches any character, which is why an unescaped domain pattern matches far more than you expected.
  • JavaScript regex has no free-spacing mode, so you cannot break a long pattern across lines with comments — build it up incrementally here instead.
  • This engine is JavaScript. PCRE, Python, and Go differ on lookbehind support and named group syntax, so a pattern verified here still needs checking if it is destined for another language.
  • Would rather describe the pattern with example strings than write regex syntax by hand? Try Regex From Examples.

Related tools

Browse all 10 Code tools

Frequently asked questions

10

Enter your regex pattern in the top input, paste your test text in the text area, and all matches are highlighted in real time as you type.

g (global — find all matches), i (case-insensitive), m (multiline — ^ and $ match line boundaries), s (dotAll — dot matches newlines), and u (unicode mode).

By default, the dot (.) does not match newline characters. Enable the s flag (dotAll) to make . match newlines, or use m (multiline) so ^ and $ match at line starts and ends.

Every match is listed in order with its full matched text and its start and end character position in the string, and each one has its own copy button. The same matches are highlighted inline in the preview above the list.

Make sure the g (global) flag is enabled — without it, the regex engine stops after the first match and returns only one result.

Turn on the m flag so that ^ and $ match the start and end of each line rather than of the whole string, and turn on the s flag when you need the dot to match newline characters too.

Two usual causes: an unescaped dot, which matches any character, and greedy quantifiers. Escape literal dots, and add a question mark after a quantifier — .*? — to make it stop at the first match instead of the last.

Not necessarily. This uses the JavaScript engine, and PCRE, Python, and Go differ on lookbehind support and named group syntax. Verify a pattern in its destination language before shipping it.

Wrap the pattern in \b word boundaries rather than spaces. Spaces fail to match at the very start or end of the string, where word boundaries still work correctly.

No. Matching runs in your browser with the native regular expression engine, so you can safely test patterns against production log lines or real user data.