Customize theme

Everyday tools / Regex Tester

Regex Tester

Test regular expressions locally with capture groups and code examples.

JavaScript example

const regex = new RegExp("\\b(\\w+)\\b", "g");
const match = regex.exec(text);

PHP example

Matching runs in JavaScript. PHP uses PCRE; syntax and supported flags can differ.

preg_match_all('~\\b(\\w+)\\b~', $text, $matches, PREG_OFFSET_CAPTURE);

How to use

Enter a JavaScript pattern without delimiters, flags and test text. Matches and capture groups update automatically.

Example

Use (hello) with flag g against hello world.

Frequently asked questions

Can an expression freeze the page?

Execution runs in a worker terminated after 750 ms. Results are capped at 500 matches. PHP examples require PCRE compatibility review.