11 ready-made presets
Email, phone, URL, password, IPv4, ISO date, slug and more, each explained in plain English.
Pick a common field type and get its regex, a plain-English explanation, and a live tester — ready to copy as JavaScript or an HTML5 pattern attribute.
Everything runs locally — nothing you type is sent anywhere.
Email, phone, URL, password, IPv4, ISO date, slug and more, each explained in plain English.
The input field turns green or red instantly so you can confirm a pattern behaves the way you expect.
Copy the raw JavaScript-ready regex, or an HTML5 <input pattern> tag with the anchors already removed.
Pick a preset, read what it enforces, then test and copy it.
Regular expressions describe a shape that a string either matches or doesn't. In JavaScript that shape is usually anchored with ^ at the start and $ at the end so a partial match in the middle of a longer string doesn't count as valid. The HTML5 pattern attribute works differently: the browser always anchors it to the whole value automatically, which is why the copyable input snippet here strips the ^ and $ characters rather than leaving them in, where they would otherwise be treated as literal characters to match.
Groups like (?=.*[A-Z]) check that a condition exists somewhere ahead without consuming characters, letting several rules combine, as in the strong password preset.
Sets like [0-9A-Fa-f] or \d describe one allowed character at a time; repeating them with {n} or + controls how many are required.
Without ^ and $, a JavaScript regex can match anywhere inside a string, which usually isn't what you want for whole-field validation.
Client-side patterns improve the experience, but the same rule should always be enforced again on the server, since client-side checks can be bypassed.
Questions about anchoring, edge cases and the tester.
The pattern attribute on an <input> is automatically anchored to match the entire value, so ^ and $ are not needed and are actually invalid in that context. This tool's copy button for the pattern snippet already strips them for you.
No single short regex perfectly validates something like every real email address or phone number in existence. These presets cover the common, practical cases well and are meant as a solid starting point, not a replacement for server-side validation.
Yes. Once you pick a preset, type into the test field below it and the border turns green for a match or red for no match as you type.
Those are lookaheads. Each one checks for a required character class (a lowercase letter, an uppercase letter, a digit, a symbol) without consuming characters, which lets several independent conditions be enforced on the same string alongside a minimum length.
No. Every pattern match happens locally in your browser using JavaScript's built-in regular expression engine. Nothing you type in the tester is transmitted or stored.