πŸ” For developers worldwide

Test & debug regex
in real time. Free.

Highlight matches, inspect capture groups, explore flags and validate patterns β€” entirely in your browser.

⚑ Real-time highlights
🎯 Capture groups
🏷️ All JS flags
πŸ“‹ Match details
πŸ§ͺ Quick samples
πŸ”’ 100% private
/
/
Matches:0
Groups:0
Chars tested:0
Ready
πŸ“₯Test String
✨Match Highlights
Matches will be highlighted here…
🎯 Match Details
Enter a regex and test string to see match details.
πŸ“– Quick Reference (click to expand) β–Ό
⚑ Sample Patterns β€” click to load

How it works

01
Enter your regex

Type your regular expression between the / delimiters at the top.

02
Set flags

Toggle flags like g, i, m or type them directly.

03
Paste test string

Enter any text in the left panel. Matches highlight instantly.

04
Inspect matches

Review each match, its position, and captured groups in the table.

πŸ›‘οΈ
100% private.

All regex processing runs entirely in your browser using native JavaScript. Your patterns and test strings are never sent to any server β€” not even us can see them.

Frequently asked questions
A regular expression is a sequence of characters that defines a search pattern. Regex patterns can match specific text, validate input formats, extract data, and perform complex find-and-replace operations. They are supported in virtually every programming language β€” JavaScript, Python, Java, PHP, Ruby β€” and in text editors, command-line tools, and databases.
Enter your regex pattern in the pattern field and your test string in the input area. The tester highlights all matches in real time as you type. You can also see the number of matches found and inspect individual match groups if your pattern uses capturing groups. This instant feedback makes it much faster to build and debug patterns compared to testing in code.
Flags modify how a regex pattern behaves. The most common flags are: g (global) β€” finds all matches instead of stopping at the first; i (case-insensitive) β€” matches both uppercase and lowercase; m (multiline) β€” makes ^ and $ match the start and end of each line instead of the whole string; s (dotAll) β€” makes the dot (.) also match newline characters. Flags can be combined, for example gi finds all matches regardless of case.
The dot (.) matches any single character except a newline. The asterisk (*) means zero or more of the preceding element, so .* matches any sequence of characters including an empty string. The plus (+) means one or more, so .+ requires at least one character. For example, .* would match an empty input while .+ would not. This distinction matters when validating fields that must not be empty.
Capturing groups are portions of a pattern enclosed in parentheses β€” for example, (\d{4})-(\d{2})-(\d{2}) for a date. Each group captures the matched text separately, making it accessible as group 1, group 2, etc. This is useful for extracting specific parts of a match β€” like year, month, and day from a date string β€” or for reordering parts in a replacement operation.
A basic email regex is: [a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}. This matches most common email formats but is not exhaustive β€” the full email specification is extremely complex. For production applications, it is best to use a well-tested library validator rather than a hand-written regex, and always confirm ownership with a verification email.
The backslash (\) serves two purposes in regex: it escapes a special character to match it literally (for example, \. matches a literal dot instead of any character), and it introduces special character classes (\d matches any digit, \w matches any word character, \s matches any whitespace, \n matches a newline). Without the backslash, characters like . * + ? ( ) [ ] { } ^ $ | have special meanings.
The most common reason is string escaping. In JavaScript and most programming languages, strings use backslash for their own escape sequences. In a regex string literal, a single backslash must be written as a double backslash β€” so the regex \d becomes '\\d' in a string. Using a regex literal (e.g. /\d+/) avoids this issue. Also check that your flags match between the tester and your code.

More free tools

πŸ“Š JSON FormatterFormat & validate JSON πŸ”— URL Encoder/DecoderEncode & decode URLs πŸ”€ Text Case ConverterUPPER, lower, Title… ✍️ Word CounterCount words & characters
βœ… Copied!
function toggleFaq(btn) { const answer = btn.nextElementSibling; const isOpen = btn.classList.contains('open'); document.querySelectorAll('.faq-question.open').forEach(q => { q.classList.remove('open'); q.nextElementSibling.classList.remove('open'); }); if (!isOpen) { btn.classList.add('open'); answer.classList.add('open'); } }