Regex Tester

Type a pattern and a text — matches are highlighted in real time.

How to use it

Type a regular expression pattern in the first field, the flags you want (g, i, m, s...) in the second, and the text to search in the third. Matching parts are highlighted in yellow automatically, with no button to click.

Most common flags

g (global — finds every match, not just the first), i (case-insensitive), m (multiline — ^ and $ match per line), s (lets . match line breaks too).

Ready-made patterns to try

To pull out ISO dates like 2026-11-18 use \d{4}-\d{2}-\d{2} with the g flag. To find consecutive repeated words, try \b(\w+)\s+\1\b with i. Parentheses create capture groups, handy for extracting only part of each match.

Greedy versus lazy

Quantifiers such as .* are greedy and grab as much as possible: in <b>a</b> and <b>c</b>, the pattern <b>.*</b> matches everything in one go, while <b>.*?</b> matches each span separately.

Frequently asked questions

Which regex "flavor" does this tool use?

JavaScript's own regular expression engine (ECMAScript) — the same one used in browsers and Node.js.

Is my text sent to any server?

No — everything runs locally in your browser, in JavaScript.

Why doesn't my pattern match anything?

Check whether special regex characters (like . * + ? ( ) [ ] {} ^ $ |) you want to use literally are escaped with a backslash.

Do named groups and lookbehind work here?

Because the engine is the browser's own, named groups ((?<year>\d{4})) and lookbehind work in current versions, but older browsers may reject them. Patterns that rely on PCRE-only features, such as atomic groups or recursion, are not valid in JavaScript.

How do I match a literal dot or a whole line?

Escape the dot as \. to match a literal period. To match a whole line, use ^.*$ with the m flag so that ^ and $ apply per line instead of to the whole text.