Regex Tester

Test and debug regular expressions online with real-time matching

//g
Quick patterns:
Contact: john@example.com, support@company.co.uk
Website: https://playcode.io/new
Phone: +1 (555) 123-4567
Date: 2024-01-15
IP: 192.168.1.1

Free Online Regex Tester & Validator

PlayCode's regex tester lets you test, validate, and debug regular expressions in real-time. This regex online tool highlights matches instantly as you type. Build and test patterns using JavaScript regex syntax — perfect for validating email addresses, URLs, phone numbers, and more.

How to Use This Regex Generator

  1. Enter your regular expression pattern in the input field
  2. Paste or type your test string in the text area below
  3. See matches highlighted in real-time — no button click needed
  4. Use the regex flags (g, i, m, s) to modify matching behavior
  5. Click quick patterns to instantly load common regex like email or URL validators

JavaScript Regex Flags Explained

This regex validator supports all standard JavaScript flags:

Global (g) — Find all matches in the string instead of stopping after the first match. Essential for counting occurrences.

Case Insensitive (i) — Match letters regardless of case. "Hello" matches "hello", "HELLO", and "HeLLo".

Multiline (m) — ^ and $ match the start and end of each line, not just the entire string. Useful for line-by-line validation.

Dot All (s) — The dot (.) matches newline characters too. By default, . matches any character except \n.

Common Regex Patterns Cheat Sheet

Use this regex builder reference to create your patterns:

Pattern Description
\dAny digit (0-9)
\wAny word character (a-z, A-Z, 0-9, _)
\sAny whitespace (space, tab, newline)
.Any character except newline
[abc]Match a, b, or c
[^abc]Match anything except a, b, or c
a*Zero or more of a
a+One or more of a
a?Zero or one of a (optional)
^Start of string (or line with m flag)
$End of string (or line with m flag)
(a|b)Match a or b (alternation)

Why Use an Online Regex Tester?

Regular expressions are powerful for pattern matching, validation, and text extraction — but they're notoriously tricky to get right. This online regex tester helps you build and debug patterns before deploying them in production code. Test your regex against real data, catch edge cases early, and validate patterns instantly — all in your browser with no signup.

Whether you're validating form inputs, parsing log files, or extracting data from text, our regex validator makes it easy to experiment and perfect your patterns before using them in your JavaScript code.

Use Regex in Your JavaScript Code

Once you've built and tested your pattern in this regex creator, use it in your JavaScript with the RegExp object or literal notation:

// Using regex literal
const pattern = /your-pattern/gi;
// Using RegExp constructor
const pattern = new RegExp('your-pattern', 'gi');
// Test if string matches
pattern.test('your string'); // true/false
// Find all matches
'your string'.match(pattern); // array of matches