Regex Tester — Regular Expression Tester
Test and debug regular expressions online with real-time match highlighting. Supports JavaScript regex with all flags. Free tool.
About this tool
Test JavaScript regular expressions with live match highlighting and flags (g, i, m, s). Debug patterns before shipping them to production code.
Example use case: Test an email or URL regex against sample strings and refine the pattern until matches are correct.
//
Quick patterns:
Hello World! Contact us at hello@example.com or support@jsondev.in
Visit https://jsondev.in for more tools.
Phone: +91-9876543210
Frequently Asked Questions
What is a regular expression (regex)?▾
A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. It is used to find, match, validate, and replace text. For example, /^[\w.-]+@[\w.-]+\.\w{2,}$/ matches email addresses.
What are common regex patterns?▾
Common patterns: Email: /^[\w.-]+@[\w.-]+\.\w{2,}$/ | URL: /https?:\/\/[\w.-]+/ | Phone (US): /^\+?1?\d{10}$/ | IP Address: /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ | Date (YYYY-MM-DD): /\d{4}-\d{2}-\d{2}/
What do regex flags mean?▾
g (global) finds all matches instead of stopping at the first. i (case-insensitive) matches regardless of case. m (multiline) makes ^ and $ match start/end of each line. s (dotAll) makes . match newlines. The flags can be combined: /pattern/gi
What is the difference between * and + in regex?▾
* matches zero or more occurrences of the preceding element. + matches one or more occurrences. So /a*/ matches '', 'a', 'aa', 'aaa' etc., while /a+/ only matches 'a', 'aa', 'aaa' etc. (requires at least one).