Regex Tester
Test and debug regular expressions with live highlighting.
How to test a regular expression
Enter the regex pattern without the surrounding slash characters, choose the flags you need, then paste a test string. Matching text is highlighted as you type, and the match list shows each result, index, and capture group.
Use the g flag to find every match, i for case-insensitive matching, m when anchors should apply to each line, and s when the dot should include newlines. If the pattern is invalid, the page shows the JavaScript regular expression error so you can fix the syntax quickly.
Build patterns from real examples
Regex debugging is easiest when you paste realistic examples and counterexamples. Add strings that should match, strings that should not match, and edge cases with punctuation, whitespace, unicode text, or multiple lines.
Start with a narrow literal match, then add character classes, groups, anchors, and quantifiers one step at a time. Watching the highlight change after each edit makes it easier to catch greedy matches, missing escapes, and patterns that accidentally match too much text.
Common regex debugging checks
If there are no matches, confirm that special characters are escaped, the right flags are enabled, and anchors such as ^ and $ are not making the pattern too strict. If there are too many matches, look for broad tokens like .*, \w+, or optional groups that can match empty text.
For extraction tasks, use capture groups to isolate the value you care about, such as an ID, date, slug, email domain, or version number. The match list makes those groups visible without writing a separate script.
Private browser-side testing
The regex is compiled and tested locally in your browser using JavaScript. FastDevTool does not upload your pattern or test string to a server.
That is useful when testing log snippets, internal identifiers, user-agent strings, validation rules, and draft parsing logic. Before using a regex in production, test it in the same language runtime as your app if that runtime has different regex behavior than JavaScript.
Related Tools
Frequently Asked Questions
What is a regular expression?
+
A regular expression (regex) is a sequence of characters that defines a search pattern. It is used to find, match, or manipulate text by describing character combinations — for example, \d+ matches one or more digits, and [a-z]+ matches one or more lowercase letters. Regex is supported in virtually all programming languages and text editors.
What do the regex flags g, i, m, and s mean?
+
The g (global) flag finds all matches in the string instead of stopping at the first one. The i (case-insensitive) flag makes the match ignore letter case. The m (multiline) flag makes ^ and $ match the start and end of each line rather than the whole string. The s (dotAll) flag makes the dot (.) character match newline characters, which it normally skips.
What is the difference between a greedy and a lazy quantifier?
+
Greedy quantifiers like *, +, and {n,m} match as many characters as possible. Lazy (non-greedy) versions like *?, +?, and {n,m}? match as few characters as possible. For example, given the string <b>hello</b>, the pattern <.*> greedily matches the entire string, while <.*?> lazily matches just <b>.
What are capture groups in regex?
+
Capture groups are portions of a pattern wrapped in parentheses that capture the matched text for later use. For example, the pattern (\d{4})-(\d{2})-(\d{2}) applied to a date string captures the year, month, and day as separate groups. Named groups use the syntax (?<name>pattern) and are accessible by name in most languages.
Why does my regex match too much or too little?
+
Overly broad matches are usually caused by greedy quantifiers or by forgetting to anchor the pattern with ^ (start) and $ (end). Undershooting often happens when special characters like ., *, or + are not escaped with a backslash when you intend to match them literally. Testing with this tool helps you immediately see what your pattern actually matches.