When to use it
To check whether strings like phone numbers and emails match a rule, or to pull specific fragments out of a long text. Matches update as you edit the pattern.
How it works
Type the pattern in the top input, then toggle g · i · m · s · u · y as flags. The right pane highlights matches. The pill row below offers common patterns (phone, email, IPv4, etc.) — click one and tweak from there.
Eight Korean-input patterns (preset library)
The "common patterns" library bundles eight ready-to-apply patterns. All are JavaScript ES2018+.
- Mobile phone —
/^(01[016789])-?(\\d{3,4})-?(\\d{4})$/Starts with 010·011·016·017·018·019, followed by 3–4 digits and 4 digits. Hyphens optional. Three capture groups normalize to 010-1234-5678 form. - Resident registration number (RRN) —
/^\\d{6}-?[1-4]\\d{6}$/Six-digit birthdate + optional hyphen + gender/century digit (1–4) + six digits. Final check-digit validation is a separate algorithm. Important: mask immediately on input — Korean PIPA Article 23 treats RRNs as sensitive. - Postal code (5 digits) —
/^\\d{5}$/Korea moved to 5-digit codes in 2015; the older 6-digit format (123-456) is no longer in use. - Business registration number —
/^\\d{3}-?\\d{2}-?\\d{5}$/3 + 2 + 5 digits, 10 total. Hyphen optional. Check-digit verification is a separate algorithm. Required for AdSense applications, tax invoices. - Hangul-only —
/^[가-힣]+$/Allows precomposed Hangul syllables (U+AC00–U+D7A3) only. Rejects decomposed Jamo (ㄱ + ㅏ). Caveat — rejects Hanja and mixed names like "Lee 영희" — verify the UX requirement first. - Email —
/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/Practical simplification of RFC 5322. Catches 99% of real emails but misses IDNs (Hangul domains). For stricter checks, send a verification link. - URL (http/https) —
/^https?:\\/\\/[\\w.-]+(?::\\d+)?(?:\\/[^\\s]*)?$/Protocol + host + optional port + optional path. Rejects ftp, file, etc. - IPv4 — Each octet bounded to 0–255.
192.168.0.1✓,256.0.0.1✗.
Common pitfalls
- Hangul doesn't match —
\\wexcludes Hangul. Use[가-힣], or theuflag with Unicode properties (\\p{L}). - Special characters —
.?+*()[]{}|\\must be escaped with\\to match literally. - Greedy matching —
.*grabs as much as it can. Use.*?for the minimal match. - Too slow — Patterns like
(a+)+can explode (ReDoS). Anything over 500ms is cancelled automatically with a notice. - Input over 100KB — Blocked to protect browser performance. Slice a sample first.
Pattern runs in a Worker with a 500ms guard
ReDoS-vulnerable patterns are auto-aborted via a Web Worker + 500ms timeout. Input capped at 100KB. Pattern and target both stay in the page.