Regex Tester — Free Online Regular Expression Tool

Free online regex tester. Write a regular expression, paste your test string, and see matches highlighted in real time. Supports JavaScript regex syntax with flags. 100% client-side — your data stays private.

/ /
Test String
Highlighted Matches
Match Details
# Match Index Length
Learn More

What Are Regular Expressions?

Regular expressions (regex or regexp) are patterns used to match character combinations in strings. They are one of the most powerful tools in programming for searching, validating, and transforming text.

Every major programming language supports regex: JavaScript, Python, Java, PHP, Go, Ruby, C#, and more. Our online regex tester uses JavaScript regex syntax (MDN reference) with real-time match highlighting.

Regular expressions were formalized by mathematician Stephen Kleene in the 1950s and brought to computing by Ken Thompson in his text editor ed for Unix.

Regex Syntax Cheat Sheet

Quick reference for the most common regex patterns:

Pattern Meaning Example
.Any character (except newline)a.c matches abc, a1c
\dAny digit (0-9)\d{3} matches 123
\wWord character (a-z, A-Z, 0-9, _)\w+ matches hello
\sWhitespace (space, tab, newline)\s+ matches spaces
^Start of string^Hello matches at start
$End of stringend$ matches at end
*0 or more of previousab*c matches ac, abc, abbc
+1 or more of previousab+c matches abc, abbc
?0 or 1 of previous (optional)colou?r matches both
[abc]Character class (a, b, or c)[aeiou] matches vowels
(abc)Capturing group(\d+)-(\d+) captures parts
a|bAlternation (a or b)cat|dog matches either

Regex Flags

Flag Meaning
gGlobal — find all matches, not just the first
iCase-insensitive matching
mMultiline — ^ and $ match line boundaries
sDotall — . matches newline characters

Common Regex Patterns

Ready-to-use regular expressions for common validation tasks:

Use Case Pattern
Email address[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}
URLhttps?://[^\s/$.?#].[^\s]*
Phone (US)\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}
IPv4 address\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
Date (YYYY-MM-DD)\d{4}-\d{2}-\d{2}
Hex color#[0-9A-Fa-f]{3,6}\b
HTML tag<[^>]+>

Frequently Asked Questions

What is a regex tester?

A regex tester is an online tool that lets you write a regular expression pattern and test it against a sample string. Matches are highlighted in real time so you can debug and refine your pattern without writing code.

What regex flavor does this tool use?

This tool uses JavaScript regex syntax, which is based on the ECMAScript standard. It supports features like lookahead, lookbehind (ES2018+), named groups, Unicode properties, and all standard flags (g, i, m, s, u, y).

What does the g flag do?

The g (global) flag tells the regex engine to find all matches in the string, not just the first one. Without it, the regex stops after the first match. This is the most commonly used flag.

How do I match a literal special character?

Escape it with a backslash. To match a literal dot, use \. instead of .. Characters that need escaping: . * + ? ^ $ { } [ ] ( ) | \.

Is my data sent to a server?

No. This regex tester runs entirely in your browser using JavaScript. Your patterns and test strings are never transmitted to any server. Safe for testing patterns against sensitive data.

Free tools that respect your privacy

No sign-up. No tracking. Everything runs in your browser.