Regex Tester

Test and debug regular expressions with live matching

Pattern
Flags:
//
Test String0 chars

About This Tool

Regular expressions (regex or regexp) are powerful patterns used to search, match, and manipulate text. They are supported in virtually every programming language and are essential for tasks like input validation, data extraction, log parsing, and text replacement. However, regex syntax can be complex and difficult to debug without the right tools. Our free online regex tester provides a live testing environment where you can write a regex pattern and immediately see all matches highlighted in your test string. It supports JavaScript regex syntax, displays captured groups, shows match details with positions, and includes a comprehensive cheat sheet covering all common patterns, anchors, quantifiers, and flags.

How to Use

  1. Enter your regular expression pattern in the regex input field. You can include flags such as g (global), i (case-insensitive), m (multiline), and s (dotAll) by appending them after the closing delimiter.
  2. Type or paste your test string into the text area below. All regex matches will be highlighted in real time as you type, with different colors for each capture group.
  3. Review the match details panel, which shows each match's position, length, and captured group values. This helps you verify that your pattern captures exactly what you intend.
  4. Use the built-in cheat sheet as a quick reference for regex syntax. Click any pattern in the cheat sheet to insert it into your regex, and experiment with different combinations.
  5. Iterate on your pattern until all matches are correct. Copy the final regex pattern to use in your JavaScript, Python, Java, or any other language that supports regular expressions.

Frequently Asked Questions

This tool uses JavaScript's RegExp engine, which supports most common regex features including character classes, quantifiers, lookaheads, lookbehinds, backreferences, named capture groups, and Unicode property escapes. While most patterns are portable across languages, some advanced features may differ between regex engines (e.g., Python's re module, PCRE, or .NET regex).
Common flags include: g (global) finds all matches instead of stopping at the first one, i (case-insensitive) makes the match ignore letter case, m (multiline) makes ^ and $ match line beginnings and ends instead of the entire string, s (dotAll) allows . to match newline characters, and u (Unicode) enables full Unicode support. You can combine multiple flags, such as /gi.
Enter a regex pattern designed for the format you want to validate. For example, a basic email regex might be /^[^\s@]+@[^\s@]+\.[^\s@]+$/. Paste several test cases including valid and invalid emails into the test string area. The highlighted matches will show you exactly which inputs pass and which fail, helping you refine the pattern for accuracy.
Yes. You can use parentheses to create capture groups, and the match details panel will show each group's captured value. Named capture groups using the (?<name>...) syntax are also supported. Backreferences such as \1 or \k<name> can be used within the pattern for matching repeated content.

Examples

Validate Email Address

Test a regex pattern to match valid email formats

^[^\s@]+@[^\s@]+\.[^\s@]+$

Extract Phone Numbers

Find phone numbers in various formats within text

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

Match URL Pattern

Validate and extract URLs from text content

https?://(?:[-\w.])+(?:[:\d]+)?(?:/(?:[\w/_.])*(?:\?(?:[\w&=%.])*)?(?:#(?:[\w.])*)?)?
Advertisement