Test regular expressions in real-time with live match highlighting.
\d - Any digit (0-9)\w - Any word character (a-z, A-Z, 0-9, _)\s - Any whitespace. - Any character+ - One or more* - Zero or more? - Zero or one^ - Start of line$ - End of lineRegular expressions (regex) are patterns used to match character combinations in strings. This tool tests your regex patterns in real-time, shows all matches, and explains what each part means.
/^[\w.-]+@[\w.-]+\.\w+$//^\d{3}-\d{3}-\d{4}$//https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}//\d+/g/\s+/gFind all matches, not just the first one
/cat/g matches "cat" and "cat" in "cat dog cat"
Ignore case when matching
/cat/i matches "Cat", "CAT", "cat"
^ and $ match start/end of each line
/^dog/m matches "dog" at start of any line
Pattern: /^[\w.-]+@[\w.-]+\.\w{2,}$/
Test: [email protected] ✓
Test: invalid@email ✗
Pattern: /\d+/g
Test: "I have 3 cats and 12 dogs"
Matches: ["3", "12"]
• \d = any digit (0-9)
• \w = any word character (a-z, A-Z, 0-9, _)
• \s = any whitespace (space, tab, newline)
Uppercase negates: \D = NOT a digit
Escape special characters with backslash \
• Literal dot: \. (instead of . which means "any char")
• Literal bracket: \[ or \]
• Literal backslash: \\
• + = one or more (at least 1)
• * = zero or more (can be empty)
• ? = zero or one (optional)
Example: colou?r matches "color" and "colour"
// Test if string matches pattern
const isEmail = /^[\w.-]+@[\w.-]+\.\w+$/.test(email);
// Find all matches
const numbers = text.match(/\d+/g);
// Replace with regex
const cleaned = text.replace(/\s+/g, ' ');