Online Regex Tester & Debugger

Build, test, and debug your JavaScript regular expressions with real-time results and syntax highlighting.

//g
The quick brown fox jumps over the lazy dog.

Match Information (0 matches)

Enter a regular expression to see matches.

Regex Cheatsheet

Character Description Example
. Any character except newline /h.t/ matches "hot", "hat"
\d Any digit (0-9) /\d3/ matches "123"
\w Any word character (a-z, A-Z, 0-9, _) /\w+/ matches "hello_123"
\s Any whitespace character (space, tab, etc.) /hello\s/ matches "hello "
[abc] Matches any one of the enclosed characters /[aeiou]/ matches any vowel
(abc) Capturing group /(\w+)\s(\w+)/ captures words
* Zero or more of the preceding character /a*/ matches "", "a", "aa"
+ One or more of the preceding character /a+/ matches "a", "aa"
^ Start of the string (or line with 'm' flag) /^Start/ matches "Start of..."
$ End of the string (or line with 'm' flag) /end$/ matches "...the end"

Frequently Asked Questions

What is a Regular Expression (Regex)?

A regular expression is a sequence of characters that specifies a search pattern. It's a powerful tool used in programming and text editing to find, replace, and manipulate text based on complex patterns. It's essential for tasks like data validation (e.g., checking if an email is in a valid format), parsing logs, and web scraping.

What do the flags (g, i, m, s) mean?

Flags modify the search behavior of the regex. The most common are:

  • g (global): Finds all matches instead of stopping after the first one.
  • i (case-insensitive): Ignores letter casing, so `/a/i` would match both "a" and "A".
  • m (multiline): Allows start `^` and end `$` anchors to match the start/end of individual lines within the text, not just the start/end of the whole string.
  • s (dotall): Allows the dot `.` metacharacter to match newline characters (`\n`), which it doesn't by default.
Why does my browser freeze with certain patterns?

This can happen due to a phenomenon called "catastrophic backtracking," where a poorly written regex can take an extremely long time to process certain strings that don't match. This often occurs with nested quantifiers, like `(a*)*`. If this happens, try to make your pattern more specific and avoid ambiguous, nested repetitions.

Private and Secure

This tool is powered by your browser's own JavaScript engine. No data is ever sent to our servers, so you can test sensitive information with complete confidence.