Regex Tester
Test regex patterns and see matches live. Free, no signup.
How It Works
Enter a regular expression and flags (e.g. g for global, i for case-insensitive). Type or paste test text below. Matches are highlighted in real time as you type. The match count and individual matches are shown below.
What Are Regular Expressions?
Regular expressions (regex) are patterns used to match character combinations in strings. They are essential for text search, validation, parsing, and find-and-replace operations in programming, text editors, and command-line tools.
Regex Flags
Flags change how the pattern is applied. Combine them in the flags box, for example gi for a global, case-insensitive search.
| Flag | Name | Effect |
|---|---|---|
| g | Global | Find all matches, not just the first |
| i | Ignore case | Match regardless of upper or lower case |
| m | Multiline | ^ and $ match at each line break |
| s | DotAll | . also matches newline characters |
| u | Unicode | Treat the pattern as Unicode code points |
| y | Sticky | Match only from the current index |
Common Regex Tokens
| Token | Matches |
|---|---|
| \d | Any digit (0-9) |
| \w | Word character (letter, digit or underscore) |
| \s | Whitespace (space, tab, newline) |
| . | Any character except newline |
| ^ / $ | Start / end of the string or line |
| * + ? | Zero or more, one or more, optional |
| {2,5} | Between 2 and 5 repetitions |
| [a-z] | Any character in the range a to z |
| (abc) | A capturing group |
| a|b | a or b |
Frequently Asked Questions
How do I test a regular expression?
Type your pattern in the top field and add any flags (like g or i) in the small box beside it, then type or paste text into the test string area. Matches are found and highlighted live as you type, with a count and a list of each match and its position below.
Which regex flavor and flags does it support?
It uses the browser's built-in JavaScript (ECMAScript) regular expression engine, so any pattern valid in JavaScript works here. Supported flags include g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode) and y (sticky). Enter them together in the flags box, for example gi.
Does it show every match and where it is?
Yes. With the global flag g, every match in the text is highlighted, the total count is shown, and each match is listed with its exact character index. Without g, only the first match is found. Zero-length matches are handled without looping.
What happens if my pattern is invalid?
If the pattern cannot be compiled, an error message appears explaining what went wrong, and no matches are shown. Fix the pattern and the results update immediately, so you can debug a regex step by step.
Is the regex tester private and free?
Yes. It is completely free with no signup, and the pattern and test text never leave your browser. All matching runs on your device with JavaScript, so nothing is uploaded to a server.