início/dev/regex

Regex Tester Online

Test & highlight regex matches

Performance Tip

Avoid greedy operators like '.*' in large inputs. They can cause 'catastrophic backtracking' and slow down your application.

Como usar Regex Tester

  1. 1

    Enter your regex pattern

    Type your regular expression in the pattern field and set the desired flags.

  2. 2

    Add test text

    Paste or type sample text to test the pattern against.

  3. 3

    View matches

    Matches are highlighted in real time with capture group details and match indices.

Perguntas frequentes

Is my data safe?
Yes. All processing happens entirely in your browser. Your data never leaves your device and is never uploaded to any server.
Which regex flavor is used?
JavaScript's built-in RegExp engine is used. This supports most standard regex features including lookahead, lookbehind, named capture groups, and Unicode property escapes (with the 'u' flag). Patterns tested here will behave identically in any browser-side JavaScript and in Node.js.
Why is my pattern matching more than expected?
Greedy quantifiers (*, +, ?) match as much as possible. Try their lazy equivalents (*?, +?, ??) to match the minimum. Also check whether the 's' flag is inadvertently enabled, causing '.' to match newlines.
What regex flags are supported?
All standard JavaScript flags: g (global — find all matches), i (case-insensitive), m (multiline — ^ and $ match at line boundaries), s (dotAll — '.' matches newlines), u (Unicode mode), and y (sticky — match only at current position).
Can I use this to test regex for Python or PHP?
The tester uses JavaScript's RegExp engine. Most PCRE features (used by Python, PHP, Ruby, and Perl) are also available in JavaScript, but there are some differences — most notably, Python's verbose mode (?x) and atomic groups are not available in JavaScript.

Saiba mais

O que é Regex Tester?

Test and debug regular expressions against sample text with real-time match highlighting. Supports JavaScript's RegExp engine with all standard flags (g, i, m, s, u, y). See match count, match positions, and named and numbered capture groups displayed alongside the highlighted text. Whether you are writing validation patterns, parsing log files, or learning regex for the first time, this tool gives instant visual feedback. Everything runs in your browser — no data sent to any server, no sign-up required.

Por que usar Regex Tester?

  • Real-time highlighting — matches appear as you type the pattern, so you see results without clicking anything.
  • Capture group display — named and numbered groups are shown alongside each match for complex pattern debugging.
  • Supports all JavaScript regex flags: g (global), i (ignore case), m (multiline), s (dotAll), u (Unicode), and y (sticky).
  • Safe error handling — invalid patterns show a readable error message instead of crashing.
  • Completely private — your test text and patterns never leave your browser.

Casos de uso de Regex Tester

Form validation patterns

Test email, phone number, URL, and postal code validation patterns against real-world inputs before adding them to your application.

Log file parsing

Develop regex patterns to extract timestamps, error codes, or structured data from log lines during incident investigation or log pipeline setup.

Search and replace patterns

Test find-and-replace patterns before using them in code editors, sed commands, or database string functions.

Data extraction from unstructured text

Build patterns to extract prices, dates, addresses, or product codes from scraped or pasted text data.

Dicas e boas práticas

  • 💡Use named capture groups (?<name>...) instead of numbered groups for complex patterns — named groups make the code that uses the match far more readable.
  • 💡The 's' flag (dotAll) makes '.' match newline characters. Without it, '.' stops at line boundaries, which is a common source of confusion.
  • 💡Test your pattern with edge cases: empty string, maximum length input, and inputs that should NOT match. Many regex bugs only appear at the boundaries.
  • 💡Greedy quantifiers (*, +) match as much as possible. If your pattern is matching too much, try their lazy equivalents (*?, +?) which match as little as possible.

Como funciona

The tester uses JavaScript's native RegExp constructor to compile and execute patterns. This means the tool tests exactly what the browser's engine will do — no translation layer between the tester and production behavior. Matching is performed with matchAll() for global patterns, which returns an iterator of match objects including index, input, and groups. Invalid regex patterns are caught and displayed as parse errors from the RegExp constructor rather than allowing the browser to throw uncaught exceptions.