Regex Tester

Test JavaScript regular expressions live in your browser. Enter a pattern and test string to instantly see match highlighting, match count, and capture group values.

Summary:This Regex Tester runs JavaScript regular expressions live in your browser with match highlighting, flag selectors, and capture group display.

Regular Expression Parameters

//g
Expression Flags
Pattern Match Status
0 Matches
Live Highlight Preview
Hello World 1234, order 5678
Regex Quick Cheat-Sheet Reference
Character Classes
  • . - Any character except newline
  • \d - Any digit (0-9)
  • \w - Word character (a-z, A-Z, 0-9, _)
  • \s - Whitespace character
  • [abc] - Any character in brackets
  • [^abc] - Any character NOT in brackets
Quantifiers
  • * - 0 or more times
  • + - 1 or more times
  • ? - 0 or 1 time (optional)
  • {n} - Exactly n times
  • {n,} - n or more times
  • {n,m} - Between n and m times
Anchors & Groups
  • ^ - Start of string / line
  • $ - End of string / line
  • \b - Word boundary
  • (abc) - Capture group
  • (?:abc) - Non-capturing group
  • (?<name>abc) - Named capture group

Embed this Tool on Your Website

Copy this code snippet to add the Regex Tester to your blog or website for free. It adjusts dynamically to mobile and desktop screens.

Share This Tool

How to Use Regex Tester

Our Regex Tester is a free browser-based tool: 1. Enter your regular expression pattern in the Pattern field. 2. Check any combination of flags: g (global), i (case-insensitive), m (multiline), s (dotAll). 3. Type or paste your test string into the Test String box. 4. Matched portions are highlighted in real time and a match count is shown below.

Regex Tester Formula / How It Works

Pattern matching runs using JavaScript's native RegExp object. To prevent browser freezes from complex patterns, matching is executed with a 2-second timeout. If a pattern exceeds this limit, a warning is displayed.

Formula:Uses JavaScript's native RegExp object for pattern matching with selected flags.
Example Calculation:

For example, the pattern (\d+) with flag g applied to the string 'Order 1234, ref 5678' will find 2 matches: '1234' and '5678', displayed in the capture group table.

Frequently Asked Questions

This tester uses JavaScript regex syntax, which follows the ECMAScript standard. It supports common features including character classes, quantifiers, groups, lookaheads, and flags (g, i, m, s, u, y). It does not support PCRE-specific syntax like (?P<name>) or atomic groups.

Enter your regular expression in the pattern field and your test string in the input field. The tester instantly highlights all matches in the input string and shows capture groups, match positions, and match count in real time as you type.

Use it as a reference, but verify: JavaScript regex is mostly compatible with Python's re module and PHP's preg functions for common patterns. Java and .NET have different syntax for some features (e.g., lookbehind length limits). Always test in your target language for production use.

Supported flags: g (global — find all matches), i (case-insensitive), m (multiline — ^ and $ match line boundaries), s (dotAll — dot matches newlines), u (Unicode mode), y (sticky — match at exact position). Select flags using the checkboxes or enter them after the closing slash.

No. All regex matching runs in your browser using the JavaScript RegExp engine. Your patterns and test strings are never transmitted to any server or stored anywhere.