Regex Tester

Test regex patterns with live match highlighting and capture groups.

Runs 100% client-side
IntermediateCopy output
On this page4 sections
//g
Flags

Preview

Test string is empty.

Matches0 matches

Enter a pattern and test string to see matches.

HOW TO USE

  1. 01Enter your regex pattern between the slashes.
  2. 02Toggle flags (g, i, m, s) as needed.
  3. 03Paste your test string below.
  4. 04Matches highlight automatically in the preview. Or pick a QA preset from the dropdown to get started quickly.

Try it

Pattern: /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g Test string: Contact us at support@qa.codes or hello@example.com

WHEN TO USE

Use this when you need to build, test, or debug a regular expression before embedding it in test code. Writing a regex from scratch is iterative — small mistakes in grouping, quantifiers, or flag choice produce wrong matches that are hard to diagnose in a test run. Paste real sample strings from logs, API responses, or form inputs to verify the pattern against actual data. QA presets cover common patterns (email, UUID, phone, date) so you can start from a working baseline and modify rather than writing from scratch.

WHAT BUGS THIS FINDS

  • Greedy quantifier over-matches

    A .* or .+ without a delimiter captures more than intended — for example, matching two adjacent email-like strings as one. The live preview highlights exactly what the pattern grabs, surfacing the over-match immediately.

  • Missing anchors cause partial matches

    A pattern without ^ and $ matches the target substring inside a longer string — a validation regex that should reject '123abc' accepts it if anchors are absent. The preview shows the exact match range.

  • Flag omissions change match behaviour

    A case-sensitive pattern silently misses uppercase variants when the i flag is absent; a single-line pattern fails on newlines when s is off — toggle flags live to confirm the change.

  • Escaped vs literal character confusion

    \d matches a digit but d matches only the letter d; \. matches a literal dot but . matches any character — the preview confirms which characters the pattern actually accepts.

QA USE CASES

01

Input validation pattern authoring

Build and test the regex for a form field validator (email, phone, postcode) against real and invalid samples before embedding it in the application or a test assertion.

02

Log parsing expression

Paste a log line and build the extraction pattern to isolate timestamps, error codes, or request IDs for automated log analysis in a test pipeline.

03

Test data filtering

Verify a regex that filters test data rows by format before feeding them into parameterised test cases — confirm it accepts valid inputs and rejects edge cases.