Regex Tester

Test regular expressions against sample text — matches highlight in real time

Flags
Pattern Use /.../ syntax or plain pattern
/ / g
Test String
Matches

Results will appear here
Enter a pattern and test string

Matches: 0
Groups: 0
Test string: 0 chars

Free Online Regex Tester

Test and debug regular expressions in real time with our free online regex tester. Enter a pattern and a test string, and matches highlight instantly — no button clicks needed. View all capture groups and their positions at a glance. All processing runs entirely in your browser using JavaScript — your data never leaves your device.

How to Use

  1. Enter your regex pattern in the Pattern field (e.g. \d{3}-\d{4} for phone numbers)
  2. Type or paste your test string in the left panel
  3. Toggle flags (g for global, i for case-insensitive, etc.) as needed
  4. Matches and capture groups appear instantly in the right panel
  5. Click Copy to copy the regex pattern to your clipboard

Supported Flags

Common Regex Patterns

Regex Syntax Quick Reference

Frequently Asked Questions

Is my input data sent to a server?
No. All regex matching is done entirely in your browser with JavaScript. Your test string is never transmitted anywhere. This tool works offline as well.
Why does my regex not match anything?
Check for escaping special characters. In regex, ., *, +, ?, (), [], {}, \, |, ^, $ are all special. Use \. to match a literal dot. Also make sure you have the global (g) flag enabled to find all matches.
What are capture groups?
Capture groups are portions of your match enclosed in parentheses (...). For example, in the pattern (\w+)@(\w+) matched against alice@example: the full match is alice@example, group 1 is alice, and group 2 is example. Groups are displayed with their index and content.
What does the global (g) flag do?
Without g, the regex engine stops after finding the first match. With g, it returns all matches. Most use cases need the global flag enabled.
Can I test regex in different programming languages?
This tool uses JavaScript's RegExp engine. Most common patterns behave the same across languages, but some features (like lookbehind (?<=...)) were added to JavaScript only in ES2018 and may not be supported in older environments or other languages' implementations.