Developer

Regex Tester

Test regular expressions against sample text with live highlighting, match tables, capture groups and replacement preview, all in your browser.

What the regex tester does

Type a pattern, pick flags, and paste the text you want to match. Every match is highlighted as you type, listed in a table with its position and capture groups, and you can enter a replacement string to preview the result of a search and replace. Invalid patterns show a clear error instead of failing silently. Presets for emails, URLs, IPv4 addresses, dates, phone numbers and hex colors give you a starting point.

Flags explained

  • g global: find every match rather than stopping at the first.
  • i ignore case: treat A and a the same.
  • m multiline: make ^ and $ match at line boundaries.
  • s dotAll: let . match newline characters.
  • u unicode: handle emoji and non-Latin scripts correctly.

Practical uses

Validate form input before it reaches your server, clean up spreadsheets exported from an old system, write redirect rules for a site migration, or extract product codes from supplier feeds. Because everything runs in your browser using the JavaScript engine, the behavior matches what you will see in front-end code and in Node. PHP and Python share most of the syntax with a few differences in lookbehind and named groups. For cleaning text rather than matching it, the slug generator and word counter may be quicker.

FAQ

Frequently asked questions

Why does my pattern match only once?
Enable the g flag. Without it the engine stops after the first match, which is the default in most languages.
What is a capture group?
Anything inside parentheses. Groups let you pull out parts of a match, such as the year from a date, and reference them in a replacement as $1, $2 and so on.
Is my text uploaded?
No. Matching happens entirely in your browser. Nothing is sent to a server.
Why is my email pattern rejecting valid addresses?
Full email validation by regex is famously hard. The preset covers common addresses. For real forms, check the basic shape with regex and confirm ownership with a verification email.
Need the real thing?

We build the sites and systems these tools measure.

Digzy Technology designs fast, search-friendly websites, stores and apps. Tell us what you have in mind.

Chat with us