Regex Tester
Test your Regular Expressions
Runs in your browser Your input never leaves your device.
About this tool
Test a regular expression against a string and see every match with its position and any capture groups. It uses your browser's JavaScript regular expression engine, so the syntax and flags are those of JavaScript. Enter a pattern, adjust the flags (the g flag is always added so all matches are listed) and type your test string. Matching runs locally in your browser. At most 1000 matches are shown. Other regex flavors such as PCRE or Python can differ in details.
How to use it
- Enter your pattern without surrounding slashes.
- Set flags if needed, for example i for case-insensitive (g is always on).
- Type or paste the test string.
- Read the list of matches with their positions and groups.
Example
@ shows the zero-based position where each match starts.
Pattern: \d+ Test string: a1 b22 c333
3 matches: @1: "1" @4: "22" @8: "333"
Common problems
- Pattern shows an error
- The pattern is not valid JavaScript regex, for example an unclosed bracket or a lookbehind your browser does not support. The message from the engine is shown.
- "No matches" but you expected some
- Check case (add the i flag), anchors (^ and $ match only at the whole string unless you add m) and escaping of characters such as . and ( .
- Pattern works here but not in your code
- Your language may use a different regex flavor or different flag names. Test in the same engine you will deploy to.