Regex Tester: test JavaScript regular expressions online

Patterns run on your browser’s own JavaScript regex engine, so the results match what new RegExp() does in your code in Chrome, Firefox, Safari or Node.js. Other languages such as Python, PHP (PCRE), Java and .NET share most syntax but differ in details like lookbehind support, possessive quantifiers and named-group syntax, so test there too if you are porting a pattern.

With the g flag every match is listed; without it only the first match is, just like RegExp.exec. Match details shows the zero-based index where each match starts, every numbered group ($1, $2…) and any named groups written as (?…). Groups that did not take part in a match are shown as undefined. Zero-length matches, such as those from ^ or lookaheads, appear in the list but are not highlighted, because there is nothing to mark. To keep the page responsive, at most 1,000 matches are listed.

Useful checks: m makes ^ and $ match at each line, s lets . match line breaks, and u enables \p{…} Unicode property escapes such as \p{L} for any letter. A pattern with nested quantifiers like (a+)+ can take exponentially long on some inputs; if typing feels slow, simplify the pattern.

Your pattern and text never leave your browser.

Read more here: Source link