Loading...
Test regular expressions with live match highlighting, flags, and error detection
Regular expressions are patterns for matching text. This tool lets you test patterns in real-time with live highlighting.
Validate user input, extract data from text, search and replace patterns, and parse structured data like logs and CSV files.
Answers about regex syntax, JavaScript engine features, character classes, and common patterns.
What are the common regex metacharacters?
Common metacharacters include: . (any character), * (zero or more), + (one or more), ? (zero or one), [] (character class), ^ (start), $ (end), | (or), and () (grouping). Escape special characters with backslash.
How do flags affect regex matching?
Flags modify matching behavior: g (global - find all matches), i (case insensitive), m (multiline - ^ and $ match line boundaries), s (dotall - . matches newlines). Combine multiple flags like /gi.
Why does my regex not match as expected?
Common issues: forgetting to escape special characters, incorrect quantifier usage, not accounting for whitespace, or mismatched delimiters. Use this tool to debug with live highlighting.
Can regex handle complex patterns?
Yes, regex can handle complex patterns including lookaheads, lookbehinds, backreferences, and conditional groups. However, very complex patterns may be hard to maintain - consider alternatives for extremely complex parsing.
Recommendations for readability, testing patterns, avoiding catastrophic backtracking, and using comments.
Common regex patterns for validation and matching.
Email: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Phone: ^\+?[1-9]\d{1,14}$
URL: ^https?:\/\/[\w\-]+(\.[\w\-]+)+\/?$
Date: ^\d{4}-\d{2}-\d{2}$
Supported flags, engine details, and regex features.