Menu

Tools

Regular Expression Tester
Test and debug regular expressions with live highlighting
Loading...

About Regex Tester

Write a regex pattern, paste some test text, and see matches highlighted instantly. The tester shows capture groups, match counts, and helps you debug patterns before using them in code.

Regular expressions look like cryptic symbols but they're incredibly powerful for text processing. This tool uses JavaScript's regex engine, so patterns you build here will work directly in JavaScript, Node.js, and TypeScript.

How to use Regex Tester

1

Enter your regex pattern in the pattern field.

2

Add flags if needed (g for global, i for case-insensitive, m for multiline).

3

Paste or type your test text.

4

Matches highlight automatically.

5

Check capture groups in the results panel.

Examples

Match email addresses

A basic email pattern that catches most formats:

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

Test text:
Contact us at support@example.com or sales@company.co.uk

Matches:
✓ support@example.com
✓ sales@company.co.uk

Extract numbers with capture groups

Parentheses create capture groups to extract specific parts:

Pattern: Price: \$(\d+\.\d{2})

Test: "Price: $19.99"

Full match: Price: $19.99
Group 1: 19.99  ← captured!

Common patterns

Useful regex patterns for everyday tasks:

Phone (US): \(?\d{3}\)?[-. ]?\d{3}[-. ]?\d{4}
URL: https?:\/\/[\w\-._~:/?#@!$&'()*+,;=%]+
Date (YYYY-MM-DD): \d{4}-\d{2}-\d{2}
IP Address: \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}

Features

Live match highlighting as you type
Shows all capture groups
Supports g, i, m flags
Match count and details
Copy regex for use in code
JavaScript regex compatible

When to use this

  • Validating email, phone, or URL formats
  • Extracting data from log files
  • Search and replace in text editors
  • Parsing structured text like CSV or logs
  • Building input validation for forms
  • Learning regex syntax and patterns

Common questions