Free Regex Tester — Match, Replace & Debug Regular Expressions Online

Test regular expressions with real-time match highlighting, capture group display, replace mode, and flag toggles. Built-in presets for emails, URLs, IPs, and more. Quick reference sidebar for instant syntax lookup. Uses JavaScript's native RegExp engine — what you see here is exactly what runs in your code. Free, no signup, works offline.

//g
Flags:
Presets:

Everything You Need to Build & Test Regex Patterns

A complete regex development environment in your browser — no installs, no accounts, no distractions.

🎯

Real-Time Matching

Matches highlight instantly as you type your pattern or test string. Color-coded highlighting makes overlapping matches easy to distinguish.

🔤

Flag Toggles

Toggle Global, Case Insensitive, Multiline, Dotall, and Unicode flags with one click. See how each flag changes your matches immediately.

📦

Capture Groups

View all capture groups — numbered and named — for every match. See group indices, values, and positions in the detail panel.

🔄

Replace Mode

Test regex replacements with $1, $2, $<name> backreferences. See the full replaced output in real time.

📋

One-Click Presets

Load common patterns instantly: email, URL, IPv4, hex color, date, phone number, HTML tags, and word boundaries.

📖

Quick Reference

Clickable cheat sheet for character classes, anchors, quantifiers, and groups. Click any token to insert it into your pattern.

How to Use the Regex Tester

1. Enter your pattern. Type a regex in the pattern field. The delimiters / / are shown automatically — just type the pattern itself. Use a preset to start quickly.

2. Set your flags. Click the flag buttons to enable Global (g), Case Insensitive (i), Multiline (m), Dotall (s), or Unicode (u). Most patterns use at least the Global flag.

3. Add test text. Paste or type your test string. Matches highlight in the preview area above the input. Match count and positions appear in the detail panel.

4. Inspect matches. The Match Details section shows every match with its index, length, captured groups, and named groups. Color coding matches the highlighted text.

5. Test replacements. Toggle Replace Mode, enter a replacement string, and see the output. Use $1, $2 for groups and $& for the full match.

Common Regex Use Cases

Form validation: Test email, phone, URL, and date patterns before adding them to your form validation code. See edge cases that break your pattern.

Log parsing: Extract timestamps, error codes, IP addresses, and user agents from log lines. Use capture groups to isolate the fields you need.

Find and replace: Test complex search-and-replace operations before running them on production data. Verify backreferences work correctly.

Data extraction: Build patterns to pull structured data from HTML, CSV, or unstructured text. Test against sample data to ensure complete coverage.

Learning regex: Use the quick reference and presets to explore how different regex constructs work. Modify presets to understand each part of the pattern.

Frequently Asked Questions

How does this regex tester work?

Type a regular expression pattern and a test string. The tool uses JavaScript's native RegExp engine to find matches in real time. Matches are color-highlighted in the preview, and detailed match information including capture groups, named groups, and positions is displayed below.

Which regex flavor does this tool use?

This tool uses the JavaScript (ECMAScript) regex engine built into your browser. It supports all modern features including named capture groups (?<name>...), lookbehind assertions (?<=...) and (?<!...), the dotall flag (s), and the Unicode flag (u). The syntax is identical to what you use in JavaScript, TypeScript, and Node.js.

What do the regex flags mean?

g (Global) finds all matches, not just the first. i (Case Insensitive) matches uppercase and lowercase equally. m (Multiline) makes ^ and $ match the start and end of each line, not just the whole string. s (Dotall) makes the dot (.) match newline characters. u (Unicode) enables full Unicode matching and makes quantifiers work correctly with emoji and multi-byte characters.

How does the replace mode work?

Enable Replace Mode and type a replacement string. The tool applies JavaScript's String.replace() with your regex and replacement. You can use $1, $2, etc. for numbered capture groups, $<name> for named groups, $& for the full match, $` for text before the match, and $' for text after. With the global flag, all matches are replaced.

What are capture groups?

Capture groups are parts of a regex enclosed in parentheses. In the pattern (\d{3})-(\d{4}), group 1 captures three digits and group 2 captures four. Named capture groups like (?<area>\d{3}) let you reference matches by name. The match details panel shows all captured groups for every match.

Can I use this regex in my code?

Yes. Click Copy Regex to copy the pattern in /pattern/flags format. Since this tool uses JavaScript's regex engine, the pattern works directly in JavaScript, TypeScript, and Node.js. Most patterns also work in Python, Java, Go, and other languages, though some features like lookbehind length limits may differ.

What are the preset patterns for?

Presets load commonly needed regex patterns with one click — email addresses, URLs, IP addresses, hex colors, dates, phone numbers, HTML tags, and word boundaries. They are a fast starting point. Click a preset, then modify it for your specific use case.

How do I match across multiple lines?

Enable the m (Multiline) flag to make ^ and $ match line boundaries. Enable the s (Dotall) flag if you need the dot (.) to match newline characters. For example, with both flags, the pattern ^.+$ will match each line individually.

Why does my regex cause the page to freeze?

Some regex patterns can cause catastrophic backtracking — for example, (a+)+ matched against a long string of a's followed by a non-matching character. If your pattern seems slow, try making quantifiers possessive or atomic, use specific character classes instead of dots, and avoid nested quantifiers.

Is my data sent to a server?

No. Everything runs entirely in your browser using JavaScript's built-in RegExp. Your patterns and test strings never leave your device. The tool works offline as a PWA — no server, no tracking, no data collection.

How does this compare to regex101?

Both use real regex engines for accurate results. This tool is faster to load, works offline as a PWA, has a cleaner interface with fewer distractions, and includes one-click presets for common patterns. For most JavaScript regex work, it is everything you need without the overhead.

Can I click reference items to insert them?

Yes. Open the Quick Reference panel and click any pattern token to append it to your regex pattern. This is useful when you forget the exact syntax for lookahead assertions, character classes, or quantifiers.

More Free Developer Tools

Test regex here, then encode strings, format JSON, compare text, generate passwords, and more with our other free tools.