Test regular expressions against any text. Matches are highlighted in real time.
Regular expressions (regex) are patterns used to match, search, and manipulate text. This tester uses JavaScript's native RegExp constructor, making it directly compatible with any JavaScript code. Enter your pattern (without delimiters) and optional flags in the dedicated field.
Key flags: g (global — find all matches, not just first), i (case-insensitive), m (multiline — ^ and $ match line starts/ends), s (dotAll — . matches newlines too). Common patterns: \d+ matches one or more digits, \w+ matches word characters, ^ anchors to line start, $ to line end, [a-z] matches a character range, (group) captures a group. Matches are highlighted in the test string and all capture groups are shown. The tester is client-side — no input leaves your browser, making it safe to test patterns against sensitive data.
A regular expression (regex) is a sequence of characters that defines a search pattern. It is used to find, match, replace, or validate text. Regex is supported in virtually all programming languages and many text editors.
Flags modify how a regex pattern behaves. Common flags: 'g' (global: find all matches), 'i' (case-insensitive), 'm' (multiline: ^ and $ match line boundaries), 's' (dotAll: . matches newlines). Flags are combined — 'gi' means global and case-insensitive.
A commonly used email pattern is: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/. This is a simplified version — RFC 5322 compliant email regex is extremely complex. For production use, sending a confirmation email is more reliable than regex validation.
This tester uses JavaScript's RegExp engine. JavaScript regex is compatible with most modern languages for basic patterns, but differences exist in advanced features: lookbehind, possessive quantifiers, and POSIX classes vary by engine. Test in your target language for final verification.