20 common regular expressions — copy, test, and use instantly
Email Address
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$Example: user@example.com
URL (http/https)
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)Example: https://example.com/path
Phone (US)
^(\+1)?[-.\s]?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$Example: (555) 123-4567
IPv4 Address
^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$Example: 192.168.1.1
Date (YYYY-MM-DD)
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$Example: 2024-01-15
Time (HH:MM)
^([01]?[0-9]|2[0-3]):[0-5][0-9]$Example: 14:30
Hex Color
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$Example: #FF5733
Strong Password
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$Example: P@ssw0rd!
Credit Card
^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11})$Example: 4111111111111111
ZIP Code (US)
^\d{5}(-\d{4})?$Example: 12345 or 12345-6789
Username (alphanumeric)
^[a-zA-Z0-9_]{3,20}$Example: user_name123
Slug (URL-friendly)
^[a-z0-9]+(?:-[a-z0-9]+)*$Example: my-blog-post
HTML Tag
<([a-z][a-z0-9]*)\b[^>]*>(.*?)<\/\1>Example: <div class='test'>content</div>
JWT Token
^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$Example: eyJ...header.payload.signature
Semantic Version
^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?$Example: 1.2.3 or 2.0.0-beta.1
MAC Address
^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$Example: 00:1A:2B:3C:4D:5E
Positive Integer
^[1-9]\d*$Example: 42
Decimal Number
^-?\d+(\.\d+)?$Example: -3.14
YouTube URL
^(https?:\/\/)?(www\.)?(youtube\.com\/watch\?v=|youtu\.be\/)([\w-]{11})Example: https://youtube.com/watch?v=dQw4w9WgXcQ
Base64 String
^[A-Za-z0-9+/]*={0,2}$Example: SGVsbG8gV29ybGQ=
Browse 20 common regular expressions online free. Copy patterns for email, URL, phone, password, IP address, date, hex color, credit card, JWT, semantic versioning, MAC address, slug, and more. Test each pattern against your own input with instant match or no-match feedback. Filter by category or search by name. Useful for developers who need quick regex examples, validation starting points, and learning references before adapting patterns to a specific project.
Writing regex from scratch is time-consuming and easy to get wrong. A single misplaced character can cause false positives, false negatives, or brittle validation logic. This collection provides practical starting points for common validation and parsing tasks. Each pattern should still be reviewed against your own requirements, locale rules, allowed edge cases, and security needs before being used in production.
JavaScript: new RegExp(pattern).test(input) or /pattern/.test(input). Python: import re; re.match(pattern, input). PHP: preg_match('/pattern/', input). Java: Pattern.compile(pattern).matcher(input).matches(). C#: Regex.IsMatch(input, pattern). Most patterns in this collection use standard regex syntax compatible with all these languages. Some patterns may need minor adjustments for language-specific syntax.
Regex can validate shape, but it cannot always prove real-world truth. An email pattern can check format but not inbox ownership. A URL pattern can check structure but not whether the page exists. A credit card pattern can match issuer ranges but still needs a Luhn check and payment processor validation. Use regex as one layer in a larger validation workflow.
Test every pattern with valid examples, invalid examples, empty strings, long strings, unusual characters, and locale-specific inputs. For user-facing forms, write unit tests around the final pattern and keep error messages helpful. Avoid overly complex patterns that are hard to maintain or may create performance issues with untrusted input.
Regex Collection Online Free is useful when you need to complete a focused task quickly without installing desktop software, creating another account, or switching into a heavy workflow. It works well for quick checks, conversions, previews, cleanups, generation tasks, and everyday operations where speed and consistency matter. Browse 20 common regular expressions online free. Copy patterns for email, URL, phone, password, IP address, date, hex color, credit card, JWT, semantic versioning, MAC address, slug, and more. Test each pattern against your own input with instant match or no-match feedback. Filter by category or search by name. Useful for developers who need quick regex examples, validation starting points, and learning references before adapting patterns to a specific project.
Start with a small sample so you understand how Regex Collection Online Free handles your input, then apply it to the full task. Review the important fields, copy or export the result, and test it in the place where you plan to use it. This keeps the tool fast while still giving you a practical quality-control step before production use.
Treat them as strong starting points, not final policy. Always test with your specific use case, locale, input source, and security requirements before production use.
Use new RegExp(pattern).test(input) or /pattern/.test(input). For example: /^[a-z]+$/.test('hello') returns true.
^ means 'start of string' and $ means 'end of string'. Together they ensure the entire string matches the pattern, not just a part of it.
Add the 'i' flag: new RegExp(pattern, 'i') or /pattern/i. This makes the pattern match both uppercase and lowercase letters.
Yes, use the test input field below each pattern to test it against your own input. A green 'Match' or red 'No match' indicator shows the result.
Yes. Regex Collection Online Free is designed as a free browser-based utility for quick personal, learning, and professional workflows.
No. You can use Regex Collection Online Free directly in a modern browser such as Chrome, Edge, Safari, or Firefox.
Yes. The page is responsive and can be used on phones and tablets, although desktop is usually more comfortable for long input or repeated copy operations.
Use clean input, test with a small sample first, review the output carefully, and adjust any details that depend on your final use case.
In most cases, yes. You can use the generated or processed output in personal and commercial projects, but legal, financial, medical, or security-sensitive work should still be reviewed by a qualified person.
The tool is built for quick browser workflows. You should still avoid entering highly sensitive data unless the specific tool clearly states how the data is handled.
Many tools include copy or download actions. If a dedicated export is not available, you can usually copy the visible result manually.
Chúng tôi không chỉ thiết kế website, mà còn giúp doanh nghiệp xây dựng thương hiệu số mạnh mẽ. Cung cấp dịch vụ thiết kế website trọn gói từ thiết kế đến tối ưu SEO. Hãy liên hệ ngay với Tấn Phát Digital để cùng tạo nên những giải pháp công nghệ đột phá, hiệu quả và bền vững cho doanh nghiệp của bạn tại Hồ Chí Minh.
Tạo file .env và .env.example cho dự án.
Tạo .gitignore cho Node.js, Python, Java.
Tạo mock JSON data cho API testing.
Format và phân tích API response.
Test REST API: GET, POST, PUT, DELETE.
Giải thích regex, flags, capture group và cảnh báo pattern dễ lỗi.
Tạo OpenAPI JSON/YAML với params, auth và request body.
Chuyển đổi Binary, Hex, Base32.
Mã hóa/giải mã Base64.
Chuyển đổi Decimal, Binary, Hex.
Tạo CSS box-shadow trực quan.
Tính quyền file Linux.