JavaScript Regex Tester & Cheatsheet

Test JavaScript regular expressions with real-time match highlighting, group extraction, flags, and cheat sheet.

JavaScript Regex Tester and Cheatsheet preview
//gi
Contact us at hello@example.com or support@test.co.uk for help.

Regex Cheatsheet

COMMON PATTERNS
SYNTAX REFERENCE
TOOLS FOR WRITING BETTER CODE
JetBrains All Products Pack
IDEs with built-in regex debugging, refactoring, and inspections.
Try free →
Regex course on Udemy
Go from this cheatsheet to writing complex patterns confidently.
View course →
DigitalOcean / hosting credit
Deploy the scripts you are testing patterns for.
Get credit →
Affiliate disclosure: links above may earn us a commission — this never affects the calculation results above.

Complete Regular Expression Syntax Guide

Regular expressions (Regex) are powerful pattern-matching strings used across software engineering, data cleaning, logs analysis, and web scraping.

Common Pattern Syntax Cheatsheet

Regex Flags Reference

Popular Regular Expression Patterns

Test and copy validated regex patterns for common input validation tasks:

🔒
Private by design — This tool processes your data 100% locally in your browser. Nothing is uploaded to Rocking Tools.

Frequently Asked Questions

Which regex engine flavor does this tester use?

This tool uses native ECMAScript (JavaScript ES2024) regular expression syntax with support for standard flags: global (g), case-insensitive (i), multiline (m), dotAll (s), unicode (u), and sticky (y).

What do \d, \w, and \s match in Regular Expressions?

`\d` matches any digit (0-9), `\w` matches any word character (letters A-Z, numbers 0-9, and underscore _), and `\s` matches whitespace (space, tab, line break).

What is the difference between greedy and lazy matching?

Greedy matchers (`*`, `+`) expand to match as much text as possible. Adding a question mark (`*?`, `+?`) makes them lazy, matching as few characters as possible.

How do I validate an email address using Regex?

A standard email validation pattern is: `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$`

Is my input text or pattern sent to a server?

No. All regex matching, substring evaluation, and group parsing execute 100% locally in your browser JavaScript thread. Your data is completely private.