Flags:

About the Regex Tester

Regular expressions are a compact syntax for describing text patterns. They are used in virtually every programming language and text editor for search, validation, and text transformation. This tester runs your regex against a test string in your browser using JavaScript's native RegExp engine and highlights every match inline.

Enter your pattern in the first field, adjust flags as needed, type or paste your test string, and matches will be highlighted automatically as you type. The match count is shown above the output area.

Frequently Asked Questions

What regex flavour does this tester use?

This tool uses JavaScript's built-in RegExp engine, which follows the ECMAScript regex specification. It supports most common features including character classes, quantifiers, groups, lookaheads, and lookbehinds. It does not support PCRE-specific syntax such as (?P<name>) named groups (use (?<name>) instead).

What do the flags do?

g (global) finds all matches rather than stopping at the first. i (case-insensitive) ignores case when matching. m (multiline) makes ^ and $ match the start and end of each line rather than the whole string.

Why are my matches highlighted in the test string?

Each successful match is wrapped in a highlight span so you can see exactly what was matched and where. Overlapping matches are not possible in standard regex — the engine advances past each match before looking for the next.

What does "Invalid regex" mean?

It means the pattern you entered contains a syntax error that JavaScript cannot parse into a valid regular expression. Common causes include unmatched parentheses, invalid escape sequences, and unclosed character classes.

Can I test multi-line strings?

Yes. The test string textarea accepts newlines. Enable the m flag to make ^ and $ anchors match line boundaries rather than the whole string boundary.