Regex Tester
Test regular expressions with live match highlighting and capture groups.
//g
How to use the regex tester
- Enter your regular expression pattern in the top field (without the surrounding slashes).
- Toggle flags as needed: i for case insensitive, m for multiline, s for dotall.
- Paste your test string in the text area below.
- Matches are highlighted in yellow instantly. The match list shows each match, its position, and any capture groups.
Common regex patterns
\d+— one or more digits[a-zA-Z]+— one or more letters\b\w+\b— whole words^.+$— entire non-empty line (with m flag)[\w.+-]+@[\w-]+\.[a-z]+— basic emailhttps?://[^\s]+— URLs\d+{3}-\d+{4}— phone pattern
JavaScript regex flavour
This tester uses JavaScript's built-in RegExp engine — the same one your browser and Node.js use. Patterns that work here will work in JavaScript code directly. Note that JavaScript does not support lookbehind in older browsers, named capture groups require ES2018+, and the s (dotall) flag requires ES2018+.
Frequently asked questions
- What is a regular expression?
- A regular expression (regex) is a pattern that describes a set of strings. It's used to search, match, extract, validate, and replace text. For example, /\d+/ matches one or more digits, and /^[a-z]+$/i matches strings containing only letters.
- What flags are supported?
- This tester supports three flags: i (case insensitive — A matches a), m (multiline — ^ and $ match line boundaries, not just string boundaries), and s (dotall — . matches newlines too). The g (global) flag is always on so all matches are found.
- How do I match a literal dot or parenthesis?
- Escape it with a backslash: \. matches a literal dot, \( matches a literal opening parenthesis. In a regex pattern, characters like . * + ? [ ] { } ( ) ^ $ | \ have special meaning and must be escaped if you want them literally.
- How do capture groups work?
- Wrap part of your pattern in parentheses to create a capture group. For example, /(\d{4})-(\d{2})-(\d{2})/ matches a date and captures year, month, and day as separate groups. The match list shows captured groups in the Groups column.
- What's the difference between greedy and lazy matching?
- Greedy quantifiers (*, +, ?) match as much as possible. Lazy quantifiers (*?, +?, ??) match as little as possible. For example, /<.+>/ on '<b>text</b>' matches the whole thing. /<.+?>/ matches '<b>' and '</b>' separately.
Related tools
- JSON Formatter
Format, beautify, minify, and validate JSON in your browser
- QR Code Generator
Generate QR codes for URLs, text, Wi-Fi, and more. Download as PNG.
- Password Generator
Generate strong, random passwords with custom length and character sets.
- Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to plain text.
- URL Encoder / Decoder
Encode or decode URLs and query strings with percent-encoding.