Regex Tester

Test regex patterns with live highlighting. Generate code for JS, Python, PHP.

Last updated: April 2026
Pattern
gims
//gi
Test String
Matches
Code Generator
Select a language above

What are Regular Expressions?

Regular expressions (regex) are patterns that describe sets of strings. They are used in virtually every programming language for searching, matching, and replacing text. A regex like \w+@\w+\.\w+ matches email addresses by specifying the pattern of characters before and after the @ symbol.

Common Regex Flags

The global flag (g) finds all matches instead of stopping at the first one. Case-insensitive (i) ignores uppercase/lowercase differences. Multiline (m) makes ^ and $ match line boundaries instead of string boundaries. Dotall (s) makes the dot character match newlines.

Privacy Advantage

Unlike regex101.com, this tool processes all patterns and test strings entirely in your browser. No data is sent to any server, making it safe to test regex patterns against sensitive data like API keys, personal information, or proprietary content.

Frequently Asked Questions

What are the most common regex patterns?

Email validation: [\w.+-]+@[\w-]+\.[\w.]+. URL matching: https?://[\w.-]+(/[\w.-]*)*. Phone numbers: \+?\d{1,3}[-.\s]?\d{3,4}[-.\s]?\d{4}. IP addresses: \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}. Dates: \d{4}-\d{2}-\d{2}. This tool lets you test any pattern against your own data instantly.

What do regex flags g, i, m, and s mean?

The g (global) flag finds all matches instead of stopping at the first. The i (case-insensitive) flag ignores uppercase/lowercase. The m (multiline) flag makes ^ and $ match line boundaries. The s (dotall) flag makes the dot match newlines. Toggle these flags in the pattern bar above.

How is this different from regex101?

ToolPry runs entirely in your browser — no data is sent to any server. On regex101, your patterns and test strings are processed on their servers and may be stored. If you are testing patterns against sensitive data like API keys, passwords, or personal information, ToolPry is the safer choice.

Can I generate code from my regex pattern?

Yes. After testing your pattern, click JavaScript, Python, or PHP to generate ready-to-use code snippets. The generated code includes the correct syntax for each language with your pattern and flags already applied.