Test regular expressions (regex) in real time, 100% in your browser. Type a pattern above and the text to analyze below: matches are highlighted instantly inside the editor and listed one by one with their position. Ideal for validating a pattern (dates, emails, IDs…), extracting data, or tuning the regex before taking it to your code. The tool locates and highlights; it does not modify your text.
1. Type the regex in "Regular expression" — just the pattern, without the slashes /…/.
2. In "Flags" put the letters you want (default gi).
3. Paste the text into "Test text".
4. After a short pause the match count, the highlight in the editor and the list below appear.
5. If the pattern is invalid you'll see "Invalid regular expression" in red.
6. The toolbar has Reset, Export and Import (saves pattern + flags + text).
Flags change how the pattern is applied. Type the letters together (e.g. gim); only g i m s u y are accepted and the rest is ignored. Note: g is always on even if you don't type it.
• g (global) — finds all matches, not just the first. It's always on here.
• i (case-insensitive) — cafe finds Cafe and CAFE.
• m (multiline) — ^ and $ match the start/end of each line, not just the whole text.
• s (dotAll) — the dot . also matches the newline. Without s, . doesn't cross lines.
• u (unicode) — reads the pattern as Unicode: enables \u
A group (...) groups part of the pattern and captures what matches inside. Three forms:
• Numbered — (\d
When the pattern is valid you'll see:
• The total number of matches at the top.
• A live highlight of each match inside the text editor.
• A list with, for each match: its index (#1, #2…), the full matched text, the position (index of the character where it starts, 0-based) and the named groups.
If there is no match, the counter stays at 0 and nothing is highlighted. Since g is always on, all matches in the text are shown.
The most common pieces:
• Classes — \d digit, \w letter/number/_, \s whitespace; uppercase, the opposite (\D, \W, \S). . any character (except the newline; see flag s).
• Sets — [aeiou] one of those; [a-z] range; [^0-9] negated.
• Quantifiers — * 0 or more, + 1 or more, ? 0 or 1,
This tool locates and highlights, it doesn't replace. But once your pattern works, you can use it to replace in your editor or in code (String.replace). In the replacement string, groups are referenced:
• $1, $2… — the content of the numbered group. E.g.: pattern (\d
• Invalid expression — unclosed parentheses or brackets, a stray quantifier (*abc) or an incomplete escape. The red warning appears and nothing is computed.
• Don't add the slashes /…/ — type just the pattern; flags go in their own field.
• The dot doesn't cross lines — . doesn't match the newline; enable flag s if you need it.
• ^ and $ across lines — without m they match the start/end of the whole text, not each line.
• Too greedy — <.*> eats too much; use the lazy <.*?>.
• Forgetting to escape — ., +, (, $… are special; escape them with \ to match them literally.