Regex Snippets
Search and copy common regex patterns — email, URL, date, and more.
How these patterns were written
These regexes were not collected from elsewhere — they were written and tested for this site. The standard they are held to is not full spec compliance but whether you can paste one in and have it do a sensible job. The email pattern, for example, deliberately does not implement RFC 5322 in full: that pattern runs to hundreds of characters and causes more problems than it solves. It catches common typos instead. When you need real validation, use a dedicated parser or an actual delivery check rather than a regex.
Regex Snippets Library
Regex Snippets is a ready-to-copy reference of the patterns developers reach for most often: email, URL, IPv4, UUID v4, hex color, URL slug, ISO date (YYYY-MM-DD), 24-hour time, international and Korean phone numbers, strong password, hashtag, mention, credit card number, semantic version, and blank/whitespace-only lines.
Each snippet ships with a recommended flag set and a matching example. The URL pattern, for instance, uses the i flag, and the Korean mobile pattern shows an example like 010-1234-5678, so you can see at a glance what kind of input a pattern accepts. These are pragmatic patterns tuned for realistic validation rather than full RFC compliance, so they drop straight into your project.
Filter the list by name, keyword, or the pattern body, then copy a pattern with one click or open it in the Regex Tester, which prefills the pattern, flags, and example for you. Searching and filtering happen entirely in your browser — nothing is sent to a server.
How to use
- Type a keyword like email, url, date, or phone in the search box to find a pattern. Search matches the name as well as the pattern body.
- Click the copy button on a snippet to put the pattern on your clipboard, then paste it into your code — remember to apply the recommended flags too.
- To try a pattern live, click the 'Open in Regex Tester' icon on the item. The tester opens with the pattern, flags, and example string already filled in.
Frequently asked questions
- Do the email and URL patterns validate every possible case?
- No. The email and URL patterns aim for realistic format validation rather than 100% RFC compliance. Extremely unusual addresses may be rejected, so confirm final validity with an actual send or request.
- Which flags should I use for each pattern?
- Every snippet shows its recommended flags — for example, i for URL, gu for hashtag, gi for mention. Opening a snippet in the tester applies these flags automatically.
- What formats does the Korean phone pattern accept?
- It accepts mobile numbers starting with 010/011/016/017/018/019, with or without hyphens. Both 010-1234-5678 and 01012345678 are recognized.
- Can I test a pattern right away?
- Yes. Click the 'Open in Regex Tester' icon on any snippet and the tester opens with the pattern, flags, and example prefilled so you can see it work immediately.