Skip to main content
SyntixDev

Regex Tester & Presets

Data, Regex & Text

Live Regex tester with presets, side-by-side Diff checker, case/slug tools, and GFM Markdown builder.

100% client-side — files and inputs never leave your browser.

//g
Quick Presets:
Brazil Presets:
Test String
2 match(es)
01310-100@14..23
01001000@39..47
Replace Preview
Av. Paulista: [CEP:01310-100] | Praça da Sé: [CEP:01001000]
About this tool and how it works

Testing regular expressions live

Type a pattern and sample text and every match is highlighted as you type, with capture groups listed per match and a replace preview that supports $1-style backreferences. The engine is your browser's JavaScript RegExp, so what matches here matches in Node.js, Deno, and front-end code.

Flags

  • g — find all matches instead of stopping at the first.
  • i — case-insensitive.
  • m — ^ and $ match at each line, not just the start and end of the text.
  • s — . also matches newlines.
  • u — full Unicode mode, needed for \p{L} and emoji-aware matching.

Presets

Start from tested patterns for email, URL, IPv4, UUID, ISO dates, and Brazilian formats (CPF, CNPJ including the 2026 alphanumeric format, CEP, phone numbers, DD/MM/YYYY dates). Presets match the shape of a value; check digits for CPF/CNPJ still need validation in code.

Writing safer patterns

  • Anchor validators with ^…$, otherwise \d{5} also matches inside 123456789.
  • Prefer specific classes ([^"]*) over .* to avoid greedy over-matching.
  • Avoid nested quantifiers such as (a+)+; on some inputs they cause catastrophic backtracking (ReDoS) and can freeze a server.
  • Use named groups — (?<year>\d{4}) — so code reads match.groups.year instead of magic indexes.

Frequently asked questions

Will a pattern tested here work in Python or Java?

Basic syntax is shared, but flavors differ: lookbehind, named-group syntax, and Unicode classes vary. This tester uses JavaScript semantics, so re-test in the target language for edge cases.

Why does my pattern only find the first match?

Add the g (global) flag. Without it, JavaScript stops after the first match.

Does the CPF preset check if a CPF is real?

No. A regex only checks the format. Validating the two check digits requires a small calculation, which our CPF generator and validator tool performs.

Other tools