Regex Tester & Debugger
Test and debug your regular expressions in real-time. Our free tool provides live match highlighting, group information, and a handy cheatsheet for JavaScript regex.
Regex Cheatsheet
| Character | Description | Example |
|---|---|---|
| . | Any character except newline | /h.t/ matches "hot", "hat" |
| \d | Any digit (0-9) | /\d{3}/ matches "123" |
| \w | Any word character (a-z, A-Z, 0-9, _) | /\w+/ matches "hello_123" |
| \s | Any whitespace character (space, tab, etc.) | /hello\s/ matches "hello " |
| [abc] | Matches any one of the enclosed characters | /[aeiou]/ matches any vowel |
| (abc) | Capturing group | /(\w+)\s(\w+)/ captures words |
| * | Zero or more of the preceding character | /a*/ matches "", "a", "aa" |
| + | One or more of the preceding character | /a+/ matches "a", "aa" |
| ^ | Start of the string (or line with 'm' flag) | /^Start/ matches "Start of..." |
| $ | End of the string (or line with 'm' flag) | /end$/ matches "...the end" |
Private and Secure
This tool is powered by your browser's own JavaScript engine. No data is ever sent to our servers, so you can test sensitive information with complete confidence.
You might also like
Helpful guides
10 Free Developer Productivity Tools That Actually Save Time
Discover the best free tools for developers that boost productivity without breaking the bank. From code formatters to API testers, these tools will streamline your workflow.
Accessibility: Alt Text Patterns for Product Images
Learn how to write effective alt text for e-commerce. Our guide provides practical patterns and examples for product images, helping you improve SEO and accessibility.
How to Test and Debug WebSocket Connections: A Step-by-Step Guide
Learn how to easily test and debug your WebSocket (WS & WSS) connections using a free online tool. This guide covers connecting, sending messages, handling heartbeats, and troubleshooting common errors.
FAQ
What is a Regular Expression (Regex)?
A regular expression is a sequence of characters that specifies a search pattern. It's a powerful tool used in programming and text editing to find, replace, and manipulate text based on complex patterns.
What do the flags (g, i, m, s) mean?
Flags modify the search behavior. 'g' (global) finds all matches instead of just the first. 'i' (case-insensitive) ignores letter casing. 'm' (multiline) allows start (^) and end ($) anchors to match the start/end of lines. 's' (dotall) allows the dot (.) to match newline characters.
Why does my browser freeze with certain patterns?
This can happen due to 'catastrophic backtracking,' where a poorly written regex takes an extremely long time to process specific strings. This often occurs with nested quantifiers like `(a*)*`. Try to make your pattern more specific.