Regex Tester
Regular expressions are famously easy to write wrong and hard to debug by staring at them. A single misplaced quantifier can make a pattern match everything or nothing. This tester highlights matches live as you type your pattern and test string, and includes a quick-reference cheat sheet so you're not tab-switching to look up what \b or (?:...) means mid-task.
How to use the Regex Tester
- Enter your regular expression pattern in the pattern input field.
- Toggle the flags you need, such as global, case-insensitive, or multiline.
- Paste or type your test string in the text area below.
- View highlighted matches, capture groups, and index positions in real time.
- Use the built-in cheat sheet for quick reference on regex syntax.
Greedy vs. lazy quantifiers, the most common regex surprise
By default, quantifiers like * and + are greedy. They match as much text as possible. Given the string <b>bold</b> and the pattern <.+>, a greedy match grabs the entire string from the first < to the very last >, not just <b> as most people expect. Adding a ? after the quantifier (<.+?>) makes it lazy, matching the shortest possible string instead. This single fix resolves a huge share of "why is my regex matching too much" problems.
Frequently asked questions
Does it support named capture groups?
Yes, along with standard numbered groups, non-capturing groups, lookaheads, and lookbehinds. The highlighting shows which part of the match came from which group.
Which regex flavor does it use: PCRE, JavaScript, or Python?
It follows JavaScript's regex engine, since that's what runs in the browser; behavior for lookbehind support and some edge cases can differ slightly from Python's re module or PCRE, so double-check flavor-specific behavior if you're writing a pattern for a non-JS environment.
Why does my pattern work here but fail in my actual code?
Usually a flags mismatch (case-sensitivity, multiline mode, global matching) or a difference in how the host language expects backslashes to be escaped in a string literal. Check both before assuming the pattern itself is wrong.
Related Tools
JSON Formatter
Prettify, minify, and validate JSON with syntax highlighting.
Text Diff Checker
Compare two blocks of text side by side and see exactly what changed — additions, deletions, and modifications.
Text Case Converter
Convert text between camelCase, snake_case, Title Case, and more.
Cron Expression Builder
Build and decode cron expressions visually — see the next run times and a human-readable description.