RegEx Pal
Pustaka pola regex umum - klik untuk menyalin atau menguji
Tips: Jelajahi pola regex umum berdasarkan kategori. Klik 'Copy' untuk menyalin pola atau 'Test' untuk mencobanya di RegEx Tester.
Validasi
Email Address
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
URL
^https?://...
Phone (International)
^\+?[1-9]\d{1,14}$
US Zip Code
^\d{5}(-\d{4})?$
Date (YYYY-MM-DD)
^[0-9]{4}-[0-9]{2}-[0-9]{2}$
Time (HH:MM 24h)
^([01]?[0-9]|2[0-3]):[0-5][0-9]$
Angka & Keuangan
Integers Only
^\d+$
Decimal Number
^-?\d+\.?\d*$
Currency (USD)
^\$?\d{1,3}(,\d{3})*(\.\d{2})?$
Visa Card
^4[0-9]{12}(?:[0-9]{3})?$
MasterCard
^5[1-5][0-9]{14}$
Teks & String
Letters Only
^[a-zA-Z]+$
Alphanumeric
^[a-zA-Z0-9]+$
Username (3-16 chars)
^[a-zA-Z0-9_-]{3,16}$
Strong Password
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)...
URL Slug
^[a-z0-9]+(?:-[a-z0-9]+)*$
Web & Kode
Hex Color
#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})
HTML Tags
<[^>]+>
IPv4 Address
^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)...){4}$
MAC Address
^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$
UUID
[a-fA-F0-9]{8}-...-[a-fA-F0-9]{12}
File & Path
Image Files
\.(jpg|jpeg|png|gif|webp|svg)$
Video Files
\.(mp4|avi|mov|mkv|webm)$
Windows Path
^[a-zA-Z]:\\(?:[^\\/:*?...]...)*...$
Unix Path
^\/(?:[^\/]+\/)*[^\/]*$