Format JSON Online logoMobile Menu

Online Regex Tester & Debugger

Real-Time Regex Tester & Debugger

Instantly test, debug, and validate your regular expressions (regex) online with detailed match information, capture groups, and a full regex cheat sheet.

Regex Pattern & Test Text
Enter your regular expression pattern and test text
//g
Match Results
Real-time matching results and capture groups
Common Regex Patterns
Click on any pattern to load it into the tester
Email Address
Matches email addresses
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
Phone Number (US)
Matches US phone numbers
\(?\d{3}\)?[-. ]?\d{3}[-. ]?\d{4}
Phone Number (INR)
Matches US Indian numbers
(?:\+91[-\s]?)?[6-9]\d{9}
URL
Matches HTTP/HTTPS URLs
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
IPv4 Address
Matches IPv4 addresses
\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b
Date (MM/DD/YYYY)
Matches dates in MM/DD/YYYY format
\b(0?[1-9]|1[0-2])\/(0?[1-9]|[12][0-9]|3[01])\/(19|20)\d\d\b
Credit Card
Matches major credit card numbers
\b(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3[0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})\b
Master Regular Expressions: A Guide & Cheat Sheet

Why Use an Online Regex Tester?

Writing regular expressions can be a complex and error-prone process. A "blind" approach often leads to frustration and bugs. Our online regex tester provides an interactive environment to build and debug patterns with confidence, offering several key advantages:

  • Instant Feedback: See matches appear and disappear in real-time as you type your pattern.
  • Visual Highlighting: Quickly identify all matching parts of your test string.
  • Capture Group Analysis: Easily inspect the data captured by each group to ensure your logic is correct.
  • Flag Emulation: Toggle flags like global (`g`), case-insensitive (`i`), and multiline (`m`) to understand their impact instantly.
  • Risk-Free Learning: Experiment with complex patterns and syntax without affecting any production code.

Regex Cheat Sheet: Core Concepts

Use this quick reference to build and understand common regex components. Test them in the editor above!

Character Classes

. - Any character except newline
\d - Any digit (0-9)
\D - Any non-digit
\w - Word character (a-z, A-Z, 0-9, _)
\W - Any non-word character
\s - Whitespace character
[abc] - Matches a, b, or c
[^abc] - Matches any character except a, b, or c

Quantifiers

* - 0 or more times
+ - 1 or more times
? - 0 or 1 time (makes it optional)
{n} - Exactly n times
{n,} - n or more times
{n,m} - Between n and m times
*? - Non-greedy version of *

Anchors & Groups

^ - Start of the string
$ - End of the string
\b - Word boundary
\B - Non-word boundary
() - Capture group
(?:...) - Non-capturing group
| - Alternation (OR operator)

Practical Use Cases

  • Form Validation: Ensure user input matches required formats for emails, phone numbers, passwords, and postal codes.
  • Log File Analysis: Extract specific information like IP addresses, timestamps, or error codes from large log files.
  • Web Scraping: Find and extract specific data points, like product prices or article titles, from HTML content.
  • Code Refactoring: Perform powerful search-and-replace operations across multiple files in code editors like VS Code.

Frequently Asked Questions

What is a regular expression (regex)?

A regular expression is a sequence of characters that specifies a search pattern in text. It is a powerful tool used in programming and text editing to find, match, validate, and manipulate strings.

How do I use this regex tester?

Simply enter your regex pattern in the 'Regular Expression' field and your test string in the text area below. The tool will instantly highlight all matches and provide a detailed breakdown of each match, including its position and any capture groups.

What are regex flags and how can I test them?

Flags modify the search behavior. Our tool supports common flags like 'g' (global search), 'i' (case-insensitive), and 'm' (multiline). You can toggle them easily in the options panel to see how they affect your pattern's matches in real-time.

What are capture groups?

A capture group, created by enclosing part of your pattern in parentheses `()`, captures the portion of the string that matches it. Our tester lists all captured groups for each match, making it easy to debug and extract specific data.

Can I use the common regex patterns provided?

Absolutely. We've included a library of common patterns for tasks like validating emails, URLs, and phone numbers. Just select one from the dropdown to load it into the tester and see how it works.

Is my data safe when using this tool?

Yes, 100%. This regex tester operates entirely in your web browser. Your regular expressions and test strings are never sent to our servers, ensuring your data remains private and secure.