regex regular expression tester online free cheat sheet

Online Regex Tester & Debugger: Free Tool for Developers

Test and debug your regular expressions online for free. Includes a regex cheat sheet, support for all flags, and real-time matching for JavaScript and more.

2026-04-16 Use This Tool

Online Regex Tester & Debugger: Free Tool for Developers

Regular expressions (regex) are incredibly powerful tools for pattern matching and text manipulation. However, they can also be notoriously difficult to get right. A single missing character or an incorrect flag can make the difference between a working script and a broken one. Our Online Regex Tester is designed to solve this problem by providing a free, real-time environment to test, debug, and refine your regular expressions.

Quick Start: Test Your Regex Now

👉 Use our Regex Tester to validate your patterns instantly. Get real-time feedback on matches and groups.

What is Regular Expression (Regex)?

A regular expression is a sequence of characters that forms a search pattern. It can be used for string matching, searching, and replacing text. Regex is supported in almost every programming language, including JavaScript, Python, PHP, Java, and C#.

While the basic syntax remains similar across languages, there are subtle differences (often called "flavors"). Our online tool primarily uses the JavaScript regex engine, which is standard for web development and highly compatible with other modern engines.

Understanding Regex Flags

Flags change how a regular expression is interpreted. Our tool supports the following standard flags:

  • g (Global): Don't stop at the first match; find all occurrences.
  • i (Ignore Case): Case-insensitive matching (e.g., [A-Z] matches a-z).
  • m (Multiline): ^ and $ match the start and end of each line, not just the whole string.
  • s (DotAll): Allows . to match newline characters.
  • u (Unicode): Treat the pattern as a sequence of Unicode code points.
  • y (Sticky): Matches only from the index indicated by the lastIndex property.

Regex Cheat Sheet: Common Patterns

To help you get started, here is a quick reference table for some of the most common regex patterns:

Pattern Meaning Example
. Any character except newline h.t matches hat, hot
\d Any digit (0-9) \d\d matches 22
\w Any word character (alphanumeric + underscore) \w+ matches word_1
\s Any whitespace character (space, tab, newline) \s matches
^ Start of string ^Hello
$ End of string world$
* 0 or more occurrences lo* matches l, lo, loo
+ 1 or more occurrences lo+ matches lo, loo
? 0 or 1 occurrence colou?r matches color, colour
[abc] Any character in the brackets [bt]at matches bat, tat
(abc) Capture group `(red

Practical Examples and Use Cases

1. Validating an Email Address

A basic email validation regex might look like this: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

2. Matching a Phone Number

For a standard US phone number format (xxx-xxx-xxxx): ^\d{3}-\d{3}-\d{4}$

3. Extracting URLs

To find all URLs in a block of text: https?:\/\/[^\s$.?#].[^\s]*

How to Use the Online Regex Tester

  1. Enter your Pattern: Type your regular expression in the "Pattern" field.
  2. Select Flags: Toggle flags like g, i, or m depending on your needs.
  3. Input Test Text: Paste the text you want to search through in the "Test String" field.
  4. View Results: Matches will be highlighted in real-time, and you can see the details of captured groups.

Common Questions (FAQ)

Q: Why isn't my regex matching in my code?

A: Check if you are using the correct "flavor" of regex. While most syntax is common, some features like "lookbehind" or certain character classes might behave differently in Python vs. JavaScript. Also, ensure you are properly escaping backslashes in your string literals (e.g., in Java, you often need \\d instead of \d).

Q: What is the difference between * and +?

A: * matches zero or more times, meaning the preceding character is optional. + matches one or more times, meaning the character must appear at least once.

Q: How do I match a literal dot .?

A: Since the dot is a special character in regex (meaning "any character"), you must escape it with a backslash: \..

Conclusion

Mastering regular expressions is a journey, but having the right tools makes it much easier. Our Online Regex Tester provides the clarity and feedback you need to build complex patterns with confidence.

Ready to debug your patterns? Try the Regex Tester now!