Regex Tester & Cheat Sheet
Test regular expressions in real-time and review common regex cheat sheets.
Regular Expression
Matches Detail (0)
No matches found
Regex Cheatsheet
Character Classes
. | Any character except newline |
\d | Any digit (0-9) |
\w | Alphanumeric character [a-zA-Z0-9_] |
\s | Whitespace (space, tab, newline) |
\D | Not a digit |
\W | Not a word character |
Anchors
^ | Start of line |
$ | End of line |
\b | Word boundary |
Quantifiers
* | 0 or more times |
+ | 1 or more times |
? | 0 or 1 time (optional) |
{n} | Exactly n times |
{n,} | At least n times |
{n,m} | Between n and m times |
Groups & Ranges
(x) | Capture group |
(?:x) | Non-capturing group |
[abc] | Any character in brackets |
[^abc] | Any character not in brackets |
x|y | Either x or y (OR) |
The Regex Tester & Cheat Sheet is a utility to validate Regular Expressions (Regex) against text patterns and reference common expressions. Running on JavaScript's native `RegExp` compiler, it executes matching tasks locally without server roundtrips. When testing input validations (e.g., emails, phone numbers, API paths), pasting corporate logs or customer text into third-party servers can trigger data leaks. This tool runs entirely in your browser, ensuring complete privacy for your log files and sample payloads. [Technical Matching and Validation] When you type a pattern and select flags (g: global, i: case-insensitive, m: multiline), the JS engine compiles a `new RegExp(pattern, flags)` object. It matches this expression against your test text, highlighting successful matches in yellow. Detailed group captures (Group 1, Group 2, etc.) and character index offsets are compiled in a sidebar table. If your regex syntax contains errors, the engine catches the exception and displays the error message in the editor. [Step-by-Step Guide] 1. Input your regex pattern in the top field (do not write leading/trailing slashes). 2. Toggle flags (global, case-insensitive, multiline) from the flag panel. 3. Paste your test payload text into the main text area. 4. View highlighted matches in the text box and check group captures in the sidebar. 5. Refer to the Regex Cheat Sheet below to compile expressions for common validators (emails, dates, IPs). [Frequently Asked Questions & Precautions] - Q: Can I copy patterns directly from the cheat sheet? - A: Yes. The cheat sheet provides one-click copy buttons for common patterns, including email validators, secure password checks, IP matching, and date structures.