Regular Expression Tester
Test and debug regular expressions
g: global, i: case insensitive, m: multiline, s: dotAll, u: unicode
1. What are Regular Expressions?
Regular expressions (regex) are powerful pattern-matching tools used to search, validate, and manipulate text. They use a special syntax to define patterns that can match specific sequences of characters, making them essential for tasks like input validation, text parsing, and data extraction.
2. How does it work?
Testing Process
The regex tester evaluates your pattern against test text in real-time. It compiles your regular expression with the specified flags, then searches through the test string to find all matches. Results show each match, its position in the text, and any captured groups defined by parentheses in your pattern.
Regular Expression Flags
- g: Global search (find all matches)
- i: Case-insensitive search
- m: Multi-line search
- s: Allows . to match newline characters
- u: Unicode; treat pattern as a sequence of unicode code points
Common Patterns
- \d: Match any digit (0-9)
- \w: Match any word character (a-z, A-Z, 0-9, _)
- \s: Match any whitespace character
- .: Match any character except newline
- +: Match 1 or more
- *: Match 0 or more
- ?: Match 0 or 1
3. Examples
Email pattern
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}Phone number
\d{3}-\d{3}-\d{4}URL
https?://[\w\-\.]+\.[a-z]{2,}