Skip to content
Developer

Regex Tester (Regular Expression Tester)

Last updated: July 11, 2026

Test regular expressions (regex) against text in real-time. See matches highlighted with full match details.

/ /

How to Use This Calculator

  1. Enter a regex pattern in the pattern field (without the delimiters).
  2. Select the desired flags (g, i, m) using the checkboxes.
  3. Enter or paste your test string in the textarea below.
  4. Results appear instantly as you type — matches are highlighted in the text and listed in the details table.
  5. Use the Common Patterns dropdown to load frequently used regex patterns.

Regex Syntax Reference

Character Classes: . (any char), \d (digit), \w (word), \s (whitespace), [abc] (character set)
Quantifiers: * (0+), + (1+), ? (0 or 1), {n} (exactly n), {n,m} (n to m)
Anchors: ^ (start of string/line), $ (end of string/line)
Groups: (...) (capture group), (?:...) (non-capturing group)
Alternation: a|b (match a or b)

Common Patterns

Email Address

[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}

URL

https?://[^\s]+

Phone Number (US)

\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}

Hex Color Code

#[0-9a-fA-F]{6}

Frequently Asked Questions

What is regex?

Regular expressions (regex) are sequences of characters that define a search pattern. They are used to match, locate, and manage text in strings. Regex is supported in most programming languages (JavaScript, Python, Go, Java) and in text editors like VS Code and Sublime Text.

What do the g, i, and m flags mean?

g (global): Find all matches in the string, not just the first one.
i (case-insensitive): Ignore case when matching. For example, /hello/i matches "Hello", "HELLO", etc.
m (multiline): Treat each line as a separate string, so ^ and $ match the start and end of each line, not just the whole string.

Where can I use regex?

Regex is used in programming languages (JavaScript RegExp, Python re, Go regexp), text editors (find/replace), command-line tools (grep, sed), form validation, web scraping, and log analysis.

Is my data sent to a server?

No. All regex testing is performed locally in your browser using JavaScript. Your pattern and test text never leave your device.

Disclaimer: All regex testing is performed locally in your browser. This tool uses JavaScript's built-in RegExp engine and may behave differently from regex engines in other languages.