Converters
Calculators
Other Tools
Browse tools
Checkers

Regex tester

Test a regular expression against a block of text — every match is highlighted inline, with capture groups listed below.

Never leaves your device No signup Free forever Not stored, not logged

Pattern

Test string

Highlighted text 0 matches
More checkers

Related tools you might need next

All checkers

How it works

Two steps, no account

1

Write a pattern and pick flags

Enter a regular expression and toggle g, i, m, and s the same way you would in JavaScript.

2

Paste text to test

Every match is highlighted inline as you type, and listed below with its index and any capture groups.

FAQ

Common questions

What regex flavor does this use?
This tool runs your pattern through JavaScript's native RegExp engine, the same engine every browser uses. It's very close to PCRE but not identical — some lookbehind and Unicode property features vary by browser version.
Why isn't the global flag doing anything without it checked?
Without g, JavaScript's RegExp stops at the first match. Leave g checked (the default here) to find every occurrence in the test string instead of just the first.
What happens if my pattern is invalid?
The exact JavaScript error message is shown — for example an unmatched parenthesis or an invalid character class — instead of the page breaking or silently showing zero matches.
Is my pattern or text sent anywhere?
No. Matching runs entirely in your browser using JavaScript's built-in RegExp — nothing is transmitted, logged, or stored.
ad slot · bottom of content 336×280 / responsive
Related

People who used this also used

Regex Tester

Our Regex Tester lets you write a regular expression and see, instantly, everywhere it matches inside a block of text. Matches are highlighted inline as you type, and every match is broken out below with its position and any capture groups — no install, no account, nothing sent to a server.

How to Use the Regex Tester

1. Write Your Pattern

  • Type a regular expression into the pattern field — no need to wrap it in slashes
  • Toggle the flags you need: g (global), i (ignore case), m (multiline), s (dotall)
  • Invalid patterns show the exact JavaScript error instead of failing silently

2. Paste Your Test String

  • Drop in any block of text — log lines, sample data, a whole document
  • Matches are highlighted inline the moment you stop typing
  • Nothing about the pattern or the text ever leaves your browser

3. Read the Match List

  • Each match is listed with its character index and the exact matched substring
  • Capture groups (parenthesized parts of the pattern) are listed underneath each match
  • A running match count tells you at a glance how many hits the pattern found

Key Features

Live Highlighting

  • Inline <mark>-style highlighting inside the rendered test string
  • Updates as you edit the pattern, the flags, or the text
  • Highlights every match, not just the first, when g is enabled

Flag Support

  • g — global, find every match instead of stopping at the first
  • i — case-insensitive matching
  • m^ and $ match the start/end of each line, not just the whole string
  • s. also matches newline characters

Capture Groups

  • Numbered groups from (...) are extracted and shown per match
  • Groups that didn't participate in a match are labeled clearly instead of showing blank

Error Handling

  • Malformed patterns (unbalanced parentheses, invalid character classes, bad quantifiers) are caught
  • The browser's own RegExp error message is shown, so you know exactly what to fix

Use Cases

1. Web Development

  • Validating form input patterns before wiring them into production code
  • Debugging why a regex isn't matching the way you expect
  • Prototyping extraction patterns for log parsing or scraping

2. Data Cleaning

  • Finding inconsistent formatting across a dataset
  • Testing a pattern against edge cases before running it over a large file
  • Confirming capture groups line up with the fields you actually want

3. Learning Regex

  • Seeing immediately how a flag changes matching behavior
  • Building up a complex pattern piece by piece with instant feedback
  • Understanding why a pattern over- or under-matches

Technical Features

  • Native Engine: Uses the browser's built-in JavaScript RegExp, not a reimplementation, so behavior matches what you'll get in real JS code
  • Real-Time Processing: Highlighting and the match list update on every keystroke
  • Safe Zero-Length Handling: Patterns that can match an empty string (like a*) don't hang the page
  • Error Handling: Invalid syntax is reported clearly instead of throwing an uncaught exception

Why Use Our Regex Tester

1. No Server Round-Trip

  • Matching happens instantly in your browser — no network latency, no rate limits
  • Works the same offline as it does online

2. Accurate to JavaScript

  • If you're writing a regex for JS code (browser or Node), this tests the exact engine you'll ship with
  • Some features differ slightly from PCRE, Python's re, or other flavors — this tool reflects JS behavior specifically

3. Privacy Focused

  • Client-side processing only
  • No data storage, no logging, no analytics on what you type into the pattern or text fields

Understanding Regular Expressions

What Is a Regular Expression?

A regular expression (regex) is a compact pattern language for describing sets of strings — used for validating input, searching text, and extracting structured pieces out of unstructured text.

Common Regex Building Blocks

  1. Character classes: [a-z], \d, \w match a category of characters
  2. Quantifiers: *, +, ?, {n,m} control how many times something repeats
  3. Anchors: ^ and $ pin a match to the start or end of a string (or line, with m)
  4. Groups: (...) capture a sub-match; (?:...) groups without capturing

Best Practices

  1. Start narrow, then widen: A pattern that's too permissive will match things you didn't intend
  2. Test edge cases: Empty strings, extra whitespace, and unexpected casing catch most regex bugs
  3. Use groups deliberately: Only capture what you actually need to extract
  4. Watch for catastrophic backtracking: Nested quantifiers on overlapping patterns can be slow on pathological input

Benefits

  1. Precision: A well-built regex validates or extracts exactly the shape of data you care about
  2. Portability: The same pattern language (with minor flavor differences) works across most programming languages
  3. Speed: Once compiled, regex matching is fast even for large chunks of text

Remember: a regex that matches your test cases isn't automatically correct for every input — always test against a few unusual or malformed examples, not just the happy path.