Regex Pattern Tester
Test a regular expression against sample text. Matches are highlighted live, you get the match count, every capture group is listed, and you can try find-and-replace with the same pattern.
/
/
0 matches
Highlighted matches
Capture groups
Groups will appear here after a successful match.
Find-and-replace test
Uses the same pattern and flags. In the replacement you can use group references such as $1, $2 and named groups such as $<name>.
Common pattern presets
Click a preset to load its pattern, flags and a sample test string.
How to use
- Type your regular expression in the pattern box and pick one or more flags.
- Paste your text in the test string area. Matches are highlighted as you type.
- Check the match count badge and expand the groups list to inspect each capture group.
- Use the replace section to try a replacement string with group references.
- Copy the pattern or the result with the Copy buttons.
Flag reference
- g (global): finds all matches instead of stopping at the first one.
- i (case-insensitive): matching ignores upper and lower case.
- m (multi-line): ^ and $ match the start and end of each line.
- s (dotAll): the dot also matches newline characters.
- u (unicode): full unicode support, needed for some special escapes.
- y (sticky): matching starts exactly where the last search left off.