Test and debug JavaScript regular expressions with real-time match highlighting.
Matches will appear here…
Click to insert pattern
Cheatsheet
| . | Any char (except newline) |
| \d | Digit [0-9] |
| \w | Word char [a-zA-Z0-9_] |
| \s | Whitespace |
| ^ | Start of string/line |
| $ | End of string/line |
| * | 0 or more |
| + | 1 or more |
| ? | 0 or 1 |
| {n,m} | Between n and m |
| (…) | Capture group |
| (?:…) | Non-capture group |
| [abc] | Character class |
| [^abc] | Negated class |
| a|b | Alternation |
A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. Regexes are used for string searching, validation, parsing, and text substitution. They are supported in virtually all programming languages including JavaScript, Python, Java, and PHP.
This tool uses JavaScript's native RegExp engine, so results match exactly what you'd see in a browser or Node.js environment. Everything runs in your browser — no data is sent to a server.
| Flag | Name | Description |
|---|---|---|
| g | Global | Find all matches, not just the first one. |
| i | Case-insensitive | Match upper and lower case letters equally. |
| m | Multiline | ^ and $ match start/end of each line, not just the full string. |
| s | Dot-all | The . metacharacter also matches newline characters. |
| u | Unicode | Enable full Unicode matching (e.g. for emoji and surrogate pairs). |
Disclaimer: This tool uses JavaScript's built-in RegExp engine. Regex behaviour may differ slightly between languages and engines. Always test in your actual runtime environment. No data is sent to any server.