Regex Playground
Test regex patterns with live highlighting
All Matches
About Regex Playground & Tester
1What is it?
Test regular expressions in real-time with live highlighting. See all matches instantly as you type your pattern. This interactive regex tester helps you build, debug, and understand regular expressions with immediate visual feedback. Supports all JavaScript regex features including lookahead and lookbehind.
2Use Cases
- Test regex patterns before using in code
- Learn regex syntax with immediate feedback
- Debug complex regular expressions
- Extract specific data from text
- Validate input patterns (email, phone, etc.)
- Find and replace with patterns
- Build data scraping expressions
3Examples
Email pattern
Input
\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\bOutput
Matches: user@example.com, test.name@domain.co.uk
US phone number
Input
\d{3}-\d{3}-\d{4}Output
Matches: 555-123-4567
Extract price
Input
(?<=\$)\d+\.\d{2}Output
Matches: 99.99 from $99.99
?Frequently Asked Questions
What regex flavor does this tool use?
JavaScript's built-in RegExp engine. It's similar to PCRE (used in PHP, Python's re module) but with some differences. JavaScript supports lookahead (?=...), lookbehind (?<=...), and named groups (?<name>...) in modern browsers.
Why doesn't my regex match anything?
Common issues: forgetting to escape special characters (use \. for literal dot), case sensitivity (use /i flag), expecting \d to match Unicode digits (it only matches 0-9), or the pattern being too specific. Start simple and build up.
How do I match across multiple lines?
By default, ^ matches string start and $ matches string end. Use the /m (multiline) flag to make ^ and $ match line starts/ends. Use [\s\S] instead of . to match any character including newlines.
What's the difference between greedy and lazy matching?
Greedy quantifiers (*, +, ?) match as much as possible. Lazy versions (*?, +?, ??) match as little as possible. For example, in '<div>text</div>', '<.*>' matches the whole string (greedy), while '<.*?>' matches just '<div>' (lazy).
How do I match special characters literally?
Escape them with backslash: \. for dot, \* for asterisk, \? for question mark, \[ for bracket, etc. Inside character classes [.] the dot is literal, but most other special chars still need escaping.