Regex Tester
Test regular expressions against text with real-time match highlighting.
Built and tested by Muhammad Irfan Liaqat · Updated
Regex Tester: key facts
- Tests JavaScript regular expressions against your text with live match highlighting
- Lists each match with its position and the value of any named capture groups
- Supports the g, i, m, s, u, v and y flags
- Matching only: there is no find-and-replace
How the regex tester works
Type a regular expression and a test string, and every match is highlighted as you type, with a list of the matches and any named capture groups. The tester uses your browser's JavaScript RegExp engine, so a pattern behaves here exactly as it will in JavaScript or Node.js code.
Seven flags can be switched on: g finds every match instead of only the first, i ignores case, m makes ^ and $ match at the start and end of each line, s lets the dot match line breaks, u turns on full Unicode matching, v is a stricter Unicode mode that adds set operations inside character classes, and y (sticky) only matches at the current position. Hover over a flag to see what it does. Other languages use slightly different regex flavours; Python, PHP and Java support most of the same syntax but differ in details such as the syntax for named groups, so test a complex pattern in its target language too.
How to test a regular expression
- 1Enter your regular expression in the pattern box
- 2Switch on the flags you need, such as g, i or m
- 3Type or paste the text to test against
- 4Check the highlighted matches and the match list