Regex Tester

Test and debug regular expressions with live match highlighting, flag controls, and a quick-reference cheat sheet.

Everything runs in your browser. Your data never leaves your device.
//g

Common Use Cases

Validate that an email address, phone number, or postal code matches an expected format
Extract all URLs or email addresses from a block of unstructured text
Write and test a URL routing pattern for an Express or Django web application
Debug a regex that matches too much or too little by testing against real sample data

About Regex Tester

Regular expressions (regex) are a powerful pattern-matching language supported by virtually every programming language and text editor. They're used to validate input (email addresses, phone numbers, postcodes), extract data (finding all URLs in a document, parsing log files), transform text (find-and-replace with capture groups), and route HTTP requests (URL path matching in web frameworks like Express, Rails, and Django).

Learning regex is a high-leverage skill. Once you understand the core syntax — character classes like `[a-z]`, quantifiers like `+`, `*`, `{n,m}`, anchors like `^` and `$`, groups and backreferences — you can write a 20-character pattern that would take 50 lines of procedural code to replicate. But regex is notoriously easy to get subtly wrong, and the only way to know your pattern is correct is to test it against real data.

This tool provides a live testing environment: type a regex pattern and test string, and matches are highlighted as you type. Flags (global, case-insensitive, multiline, dotAll, unicode, sticky) are toggleable individually. Named capture groups, numbered groups, and the full match are shown with their values. A built-in cheat sheet covers the most commonly needed syntax without having to leave the page.

Common gotchas to watch for: the dot `.` matches any character except newline by default (use the `s` flag to include newlines); quantifiers are greedy by default (add `?` after them for lazy matching); and special characters like `.`, `+`, `(`, `[` must be escaped with a backslash if you want to match them literally.

Frequently Asked Questions