Regex Tester

Test and debug JavaScript regular expressions in real-time.

//

Matches (0)

No matches found.
Advertisement

Regex Reference (JavaScript Flavor)

Character Classes

  • . - Any character except newline
  • \w - Word character (a-z, A-Z, 0-9, _)
  • \d - Digit (0-9)
  • \s - Whitespace character
  • [ABC] - Any character in set
  • [^ABC] - Not in set

Quantifiers

  • * - Zero or more times
  • + - One or more times
  • ? - Zero or one time
  • {3} - Exactly 3 times
  • {3,} - 3 or more times
  • {3,6} - Between 3 and 6 times

What is a Regular Expression?

A Regular Expression (often abbreviated as Regex or RegExp) is a sequence of characters that specifies a search pattern. Developers use these patterns to search for, extract, or replace specific strings of text within a larger body of text (like finding all email addresses in a document, or validating a password format).

This regex tester runs entirely in your browser using the standard JavaScript regex engine, ensuring your data is kept completely private while providing instant execution.

Understanding Regex Flags

g (Global)

By default, a regular expression stops searching after finding the first match. The Global flag tells the engine to keep searching through the entire string and return all matches.

i (Case Insensitive)

Makes the search case-insensitive. For example, the pattern /apple/i will match "apple", "APPLE", and "ApPlE".

m (Multiline)

Changes the behavior of the ^ (start) and $ (end) anchors to match the start and end of lines instead of the start and end of the entire string.

Common Regex Patterns

PatternDescription
^[a-zA-Z0-9]+$Alphanumeric string (letters and numbers only)
^\d5(-\d4)?$US ZIP code (5 digits, optional 4 digit extension)
^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]6)([\/\w \.-]*)*\/?$URL validation
^#?([a-fA-F0-9]6|[a-fA-F0-9]3)$Hexadecimal Color Code

Frequently Asked Questions

Does this tool support Python or PCRE regex syntax?

This tester uses the JavaScript (ECMAScript) regex engine specifically, since it runs in your browser. Most patterns are compatible across engines, but some syntax (like Python's named-group format or PCRE-specific lookbehind variations) can differ slightly.

Why does my pattern only match the first occurrence?

By default, JavaScript regex stops after the first match unless the global (g) flag is enabled — check the "g" checkbox to find and highlight every match in the text.

What's the difference between greedy and lazy quantifiers?

Greedy quantifiers (like * or +) match as much text as possible, while their lazy counterparts (*? or +?) match as little as possible. This distinction matters most when a pattern could match multiple valid substrings within the same text.

Is my test string or pattern sent to a server?

No — regex evaluation runs entirely in your browser's built-in JavaScript engine, so nothing you type here is transmitted anywhere.

⚡ Related Developer Tools

View All 30+ Tools →