About This Tool
What is Regex Tester?
A tool for testing regular expressions with real-time matching against test strings. Used for debugging and developing regex patterns for string searching, validation, and text parsing in development workflows.
How to Use
- Enter your regex pattern in the top input field.
- Enter the test string in the area below.
- Matching portions are highlighted in real-time.
- Configure flags (case insensitive, multiline, etc.) to adjust matching behavior.
Key Features
- Real-time regex matching with highlighting
- Case insensitive, multiline, and dotAll flags
- Detailed match text, position, and capture group display
- ECMAScript, RE2, and PCRE2 engine selection
Tips
- For email validation, use standardized regex patterns rather than simple ones.
- Capture groups () allow you to extract specific matched portions.
- Using the ? quantifier performs lazy (non-greedy) matching instead of the default greedy matching.
Regex Tester
Test regular expressions with real-time matching
Frequently Asked Questions
What is the difference between ECMAScript, RE2, and PCRE2 engines?▼
ECMAScript is the standard JavaScript regex engine. RE2 (used by Go, Google) is faster and guarantees linear time but lacks features like backreferences and lookahead. PCRE2 (used by PHP, Nginx) is the most feature-rich, supporting recursion, conditional patterns, and more.
What does the 'g' (global) flag do and when should I use it?▼
Without the 'g' flag, a regex stops after the first match. With 'g', it finds all matches in the string. Use 'g' when you need to find or replace all occurrences. Note: in JavaScript, using 'g' with test() can produce inconsistent results due to lastIndex state.
How do I match text across multiple lines?▼
By default, ^ and $ match the start/end of the entire string, and . doesn't match newlines. Enable the 'm' (multiline) flag to make ^ and $ match line boundaries. Enable the 's' (dotAll) flag to make . match newline characters as well.
Related Tools
Codec (Encoder / Decoder)
Encode and decode text in Base64, Base64URL, Base32, Hex, and ASCII85
URL Encoder / Decoder
Encode or decode URL strings
Data Format Converter
Convert and validate between JSON, YAML, TOML, XML, INI, and Properties formats
Hash Generator
Generate MD5, SHA-1, SHA-256, SHA-512 hashes from text
JWT Encoder / Decoder
Encode or decode JWT tokens
Case Converter
Convert text between camelCase, PascalCase, snake_case, and more — all at once