UtilToolkits2025-12-23
TL;DR — Use the Regex Tester to write patterns with live match highlighting, see capture groups in a side panel, and get a plain-English explanation of what each part does. Built-in cheat sheet, flag toggles, and copy-ready snippets for JavaScript, Python, Java, and Go. For cleaning the text you’re going to match against, the Text Cleaner; for diffing expected vs actual results, the Diff Checker.
The reason regex looks like line noise (^[\w.-]+@[\w.-]+\.[a-z]{2,}$) is that it’s a tiny dense language where every character matters. The cure isn’t memorization — it’s feedback. Once you can see what your pattern matches in real time, learning takes hours instead of weeks.
| Token | Matches |
|---|---|
. | Any character except newline |
\d / \D | A digit / non-digit |
\w / \W | A word char (a-z, 0-9, _) / non-word |
\s / \S | Whitespace / non-whitespace |
^ / $ | Start / end of string (or line, with m flag) |
* / + / ? | 0+ / 1+ / 0 or 1 of previous |
{n} / {n,m} | Exactly n / between n and m |
[abc] / [^abc] | Any of a, b, c / none of |
(...) | Capture group |
(?:...) | Non-capturing group (use when you just need grouping) |
That’s 90% of all regex you’ll ever write.
// Email (good enough for most validation)
/^[\w.-]+@[\w.-]+\.[a-z]{2,}$/i
// US phone (digits, dashes, dots, parens, optional country)
/^\+?1?[\s.-]?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/
// ISO date YYYY-MM-DD
/^\d{4}-\d{2}-\d{2}$/
// URL (lenient)
/^https?:\/\/[\w.-]+(?:\/[^\s]*)?$/i
// Strong password (8+ chars, upper, lower, digit, symbol)
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{8,}$/
// Reformat MM/DD/YYYY → YYYY-MM-DD via replace
// Pattern: /^(\d{2})\/(\d{2})\/(\d{4})$/
// Replace: $3-$1-$2
g global, i case-insensitive, m multiline) and watch matches update..* matches as much as possible. Use .*? when you want the shortest match. The difference between <.*> and <.*?> on <b>hi</b> is everything.example.com as a regex matches any char between example and com. You want example\.com.(a+)+$ on a long input can hang for seconds. Avoid nested quantifiers on overlapping classes.Mostly. Both follow PCRE-ish syntax. JavaScript lacks some features (named groups have slightly different syntax, no atomic groups). The Regex Tester emits language-specific snippets.
Add the i flag — e.g., /hello/i matches "Hello", "HELLO", and "hello".
You’re probably using greedy quantifiers. Replace .* with .*? (lazy) or with a more specific character class like [^<]*.
Usually no — but specific patterns (nested quantifiers, lookaheads on huge strings) can degrade badly. The tester warns when it detects a likely catastrophic-backtracking pattern.