What is a regular expression?
A regular expression (regex) is a pattern that describes a set of strings. You can use it to search for text matching a rule (e.g., any email address), validate user input, extract data from structured text, or perform complex find-and-replace operations. They're supported in nearly every programming language and text editor. This tester uses the browser's native RegExp engine, so the behavior exactly matches JavaScript's regex implementation.
How to use this tool
- 1 Type your regex pattern between the two / delimiters. Add flags (g, i, m, s) in the field after the closing /.
- 2 Use the quick flag buttons below the field to toggle common flags.
- 3 Paste your test string in the Test String box — all matches are highlighted immediately.
- 4 The Matches panel below lists each match with its start/end index.
Frequently asked questions
What regex flavor does this use?
JavaScript ECMAScript regex, which supports look-ahead, named capture groups (?<name>…), non-greedy quantifiers, and the s (dotAll) flag. It does not support look-behind in older Safari versions, POSIX classes, or atomic groups.
What does the g flag do?
Without g, the regex finds only the first match and stops. With g (global), it finds every non-overlapping match in the string. The match count and highlight both reflect however many matches g finds.
Why is my regex matching too much?
You probably need to be more specific or add anchors. .* is greedy and matches as much as possible. Try .*? for non-greedy matching, or add start ^ and end $ anchors to constrain the pattern.
How do I escape special characters?
Characters like . * + ? ( ) [ ] { } ^ $ | \ have special meaning in regex. To match them literally, prefix with a backslash: \. matches a literal dot, \( matches a literal parenthesis.
Is my data sent anywhere?
No. All matching runs locally using the browser built-in RegExp object. Your pattern and test string never leave your device.