Skip to main content
Utilavo
//.*

Regex Tester

Test and debug regular expressions online with live matching and capture groups

How to use Regex Tester

  1. Enter your regex pattern

    Type your regular expression in the pattern field. JavaScript regex syntax is supported.

  2. Set flags

    Toggle flags as needed: g (global — find all matches), i (ignore case), m (multiline), s (dotAll — dot matches newlines).

  3. Enter test text

    Paste or type the text you want to match against in the test area below.

  4. Review matches

    Matches are highlighted in real time. Capture groups are shown in the match list.

//g

Flags

What is a regular expression (regex)?

A regular expression (regex or regexp) is a pattern used to match, search, and manipulate text. Regex is built into virtually every programming language and is used to validate inputs, extract data, find and replace strings, and parse structured text formats.

This tester lets you write a regex pattern and see matches highlighted in real time. It supports JavaScript regex syntax with all standard flags (global, case-insensitive, multiline, dotAll, unicode). Match results and capture groups are shown as you type.

Regular expressions are indispensable for tasks like validating email addresses, phone numbers, and credit card formats; extracting dates, URLs, and IP addresses from unstructured text; parsing log files and CSV data; and performing complex find-and-replace operations in code editors. Common patterns include d{4}-d{2}-d{2} for ISO dates, [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,} for email addresses, and ^s*$ for matching blank lines. This tester is useful both for learning regex interactively and for debugging production patterns before deploying them.

The tester runs your pattern in an isolated Web Worker with a 1-second hard timeout, so catastrophic backtracking from patterns like (a+)+ on long input strings will be safely terminated instead of freezing your browser tab. This safety measure is especially important when testing user-supplied patterns or when experimenting with complex lookahead and lookbehind assertions. The match result panel shows the full match text, all numbered capture groups, and named capture groups (using JavaScript's (?<name>...) syntax), with character positions for each match. For a comprehensive introduction to regex syntax and common patterns, see our regular expressions beginner's guide.

Frequently asked questions

What regex flavor does this tester use?

JavaScript (ECMAScript) regex syntax. This is the same flavor used in Node.js, browser JavaScript, and most modern web frameworks. It differs slightly from PCRE (Perl-compatible) used in PHP, Python, and many other languages.

What are regex flags?

Flags modify how the pattern matches: g finds all matches (not just the first), i makes matching case-insensitive, m makes ^ and $ match line boundaries, s makes . match newlines.

What are capture groups in regex?

Capture groups are parenthesized parts of a pattern that capture the matched text for extraction. For example, (\d{4})-(\d{2})-(\d{2}) matches a date and captures year, month, and day separately.

Why does my regex work in Python but not in this tester?

This tester uses JavaScript regex syntax, which differs from Python's re module. Common differences include lookbehind assertions (limited width in older JS engines), the absence of named groups with (?P<name>...) syntax (JS uses (?<name>...) instead), and no atomic groups or possessive quantifiers.

What is catastrophic backtracking and how does this tester handle it?

Catastrophic backtracking occurs when a regex engine explores an exponential number of possible match paths on certain inputs — for example, the pattern (a+)+ against a long string of a's followed by a non-matching character. This can freeze a browser tab for seconds or minutes. This tester runs all regex execution in a Web Worker with a strict 1-second timeout. If your pattern causes excessive backtracking, the worker is terminated and an error is shown instead of locking up your browser.

How do I match text across multiple lines?

Enable the s (dotAll) flag to make the . metacharacter match newline characters as well as regular characters. Without this flag, . matches everything except newlines. For patterns that need ^ and $ to match the beginning and end of each line (not just the entire string), enable the m (multiline) flag. Combining both flags gives you full multi-line matching capability.

Related tools

Related guides