Luminesca Tools
All Tools / Developer

Developer / TOOLKIT

Regex Tester

Last updated:

Test regular expressions with live match highlighting, groups and flags.

Free to use · No account needed

Preparing the matcher…

Up to 100,000 text characters and 2,000 pattern characters. Shows the first 1,000 matches; slow matches stop after 2 seconds. Initial loading has a separate 15-second limit. All matching stays on your device.

Matches highlighted below

How to use

  1. Type your pattern in the pattern box - leave out the surrounding slashes.
  2. Tick flags: g (all matches), i (ignore case), m (multiline), s (dot matches newline), u (unicode).
  3. Paste test text. Matches highlight inline and appear in the results list with positions and captured groups.

Build and test regular expressions in real time with instant match highlighting, explanation of each pattern part and test cases. Save hours debugging regexes for validation, parsing and search. Works fully offline in your browser.

Use cases

1. Use case: Validate form input Test an email or phone pattern against real user input before shipping your form validation.

2. Use case: Extract patterns from logs Use a pattern like an IPv4 address to find and highlight matching lines in server logs.

Practical tips

Matches highlight as you type, which makes incremental pattern-building practical: start with the literal text, then generalize. Capture groups show separately — wrap the part you actually want to extract, not the whole pattern. Greedy quantifiers (the default) eat as much as possible; add the lazy modifier when a pattern overshoots. Remember the flags: global changes how many matches are found, and case-insensitivity matters more than people expect. Escape metacharacters like dots when you mean a literal dot. Like every tool on this site, the Regex Tester runs entirely in your browser: the data you enter never leaves your device, nothing is uploaded to a server, and the tool keeps working if your connection drops.

Common mistakes

Regex failures concentrate in four habits:

  • Forgetting to escape metacharacters — a literal dot needs a backslash, while an unescaped dot matches any character.
  • Leaving greedy quantifiers in place when the pattern overshoots; add the lazy modifier to stop at the first valid match.
  • Wrapping the whole pattern in parentheses instead of capturing only the part you actually want to extract.
  • Ignoring flags: the global flag changes how many matches are found, and case-insensitivity matters more than people expect.

Boundary and failure cases

JavaScript RegExp is not identical to every server-side flavour. Lookahead, lookbehind, Unicode property escapes and possessive quantifiers differ across engines. A pattern that passes here may still fail in Python, Go, PCRE or a database REGEXP implementation.

Catastrophic backtracking is a real failure mode. Nested quantifiers such as (a+)+b on long non-matching input can freeze the tab. Keep sample strings short while you debug, prefer atomic or more specific alternatives, and never run untrusted patterns against untrusted input in production.

Flags change meaning: without g, only the first match is reported; without m, ^ and $ refer to the whole string; without u, surrogate pairs and \p{} escapes misbehave. Always record the flags beside the pattern when you copy a working example into code.

Frequently asked questions

Does the Regex Tester send my data anywhere?

No. Pattern matching runs with the browser's RegExp engine on this device. Patterns and sample text are not uploaded by the tester.

Why does my pattern match only the first occurrence?
Without the global flag, the engine stops after the first match. Enable g to list every match. Remember that sticky (y) and lastIndex behaviour also depend on how your application calls exec.
Why does my pattern match too much text?
Quantifiers are greedy by default. A wildcard between two tags often consumes through the last tag. Prefer a negated character class, a non-greedy quantifier, or an explicit length limit.
Can I rely on this for production validation?
Use it to explore and document behaviour. Production validators should live in the same language and library as the service that enforces the rule, with unit tests for both match and non-match cases.
What do the flags mean?
g finds all matches; i ignores case; m lets ^ and $ match line edges; s lets the dot match newlines; u enables Unicode-aware matching. Combine only the flags your target engine supports.
Does multiline mode change how \n is matched?
m changes anchors, not the literal newline character. To match across lines with a dot, you usually need the s (dotAll) flag or an explicit [\s\S] class.
Is my text uploaded anywhere?
No. Matching stays in the browser. Avoid pasting secrets; clear the fields when you finish.

From our maintenance notebook: When a regular expression freezes the page: a cancellable browser tester. Includes reproducible examples and the limits of this tool.