Regex tester

Test regular expressions against any text. Matches are highlighted in real time.

Enter a pattern above
Matches highlighted

How the regex tester works

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.

Frequently asked questions

What is a regular expression?

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.

What are regex flags?

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.

How do I match an email address with regex?

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.

Is this regex compatible with my programming language?

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.

Related tools

JSON formatter → JWT decoder → Cron parser →