Regex Library
Searchable collection of common regex patterns
Matches standard email addresses
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$[email protected][email protected]Matches HTTP/HTTPS URLs
^https?:\/\/(www\.)?[a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$https://example.com/pathftp://file.txtMatches domain names without protocol
^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$sub.example.com-invalid.comMatches URL slugs
^[a-z0-9]+(-[a-z0-9]+)*$my-blog-postMy Blog PostMatches positive or negative integers
^-?\d+$-423.14Matches decimal numbers
^-?\d+\.\d+$3.1442Matches hex color codes
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$#ff5733#xyzMatches binary strings
^[01]+$10110102Matches octal numbers
^0[0-7]+$0755089Matches numbers in scientific notation
^-?\d+(\.\d+)?[eE][+-]?\d+$1.5e101.5x10Matches ISO 8601 date format
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$2024-01-152024-13-01Matches US date format
^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$01/15/202413/01/2024Matches European date format
^(0[1-9]|[12]\d|3[01])\/(0[1-9]|1[0-2])\/\d{4}$15/01/202432/01/2024Matches 24-hour time format
^([01]\d|2[0-3]):[0-5]\d:[0-5]\d$14:30:0025:00:00Matches ISO 8601 datetime
^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$2024-01-15T14:30:00Z2024-01-15 14:30Matches US phone numbers
^\(?\d{3}\)?[-\s]?\d{3}[-\s]?\d{4}$(555) 123-4567123-45-6789Matches E.164 international phone format
^\+?[1-9]\d{1,14}$+14155552671+0123Matches UK phone numbers
^(\+44|0)\d{10}$+447911123456+44123At least 8 chars: uppercase, lowercase, digit, special
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$Str0ng!PassweakpassAt least 6 chars: uppercase, lowercase, digit
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{6,}$Pass12passMatches 4 to 6 digit PIN codes
^\d{4,6}$1234123Matches Unix/Linux file paths
^\/([a-zA-Z0-9._-]+\/)*[a-zA-Z0-9._-]+$/usr/local/bin/nodeC:\folderMatches Windows file paths
^[a-zA-Z]:\\([^\\/:*?"<>|]+\\)*[^\\/:*?"<>|]+$C:\Users\file.txt/usr/localMatches file extensions
\.[a-zA-Z0-9]{1,10}$file.txtnoextensionMatches common image file extensions
\.(jpg|jpeg|png|gif|bmp|svg|webp)$photo.jpgdoc.pdfMatches paired HTML tags with content
<([a-zA-Z][a-zA-Z0-9]*)\b[^>]*>.*?<\/\1><div>hello</div><br/>Matches self-closing HTML/XML tags
<[a-zA-Z][a-zA-Z0-9]*\b[^>]*\/><br/><div></div>Matches HTML comments
<!--[\s\S]*?--><!-- comment -->// commentMatches HTML entities
&[a-zA-Z]+;|&#\d+;|&#x[a-fA-F0-9]+;&& ampMatches IPv4 addresses
^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$192.168.1.1256.1.1.1Matches full IPv6 addresses
^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$2001:0db8:85a3:0000:0000:8a2e:0370:7334192.168.1.1Matches MAC addresses
^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$00:1B:44:11:3A:B700:1B:44Matches valid port numbers (1-65535)
^([1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$808070000Matches CIDR notation
^\/(3[0-2]|[12]?\d)$/24/33Matches Visa card numbers
^4[0-9]{12}(?:[0-9]{3})?$41111111111111115111111111111111Matches Mastercard numbers
^5[1-5][0-9]{14}$55000000000000044111111111111111Matches American Express card numbers
^3[47][0-9]{13}$3782822463100054111111111111111Matches Visa, MC, Amex, Discover
^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$41111111111111111234567890Matches 3 or 4 digit CVV codes
^\d{3,4}$12312Matches UUID version 4
^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$550e8400-e29b-41d4-a716-446655440000550e8400Matches US Social Security Numbers
^(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}$123-45-6789000-00-0000Matches hexadecimal strings
^[0-9a-fA-F]+$deadbeefghijklMatches MD5 hash strings
^[a-fA-F0-9]{32}$d41d8cd98f00b204e9800998ecf8427eabc123Matches SHA-256 hash strings
^[a-fA-F0-9]{64}$e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855shortMatches JWT token structure
^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+$eyJhbGci.eyJzdWIi.SflKxwRJnot.a.jwt.tokenMatches semantic versioning (semver)
^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-[\da-zA-Z-]+(\.[\da-zA-Z-]+)*)?(\+[\da-zA-Z-]+(\.[\da-zA-Z-]+)*)?$1.2.3-beta.11.2Regex Library
Searchable collection of common regex patterns
Features
- 46 ready-to-use regex patterns across 11 categories: Email, URLs, Numbers, Dates, Phones, Passwords, File Paths, HTML/XML, Network, Credit Cards, Identifiers
- Test any pattern against your input text right in the page
- Patterns are practical / pragmatic — the email pattern catches the common 95% rather than chasing RFC 5322's full complexity
- Copy any pattern to clipboard with one click
- Patterns include explanatory examples in the description
How to use
- Browse categories or use the search box to find patterns.
- Review the regex pattern, description, and examples.
- Click the copy button to copy the regex to your clipboard.
Tips & Best Practices
- The "email" regex is the canonical compromise: short, fast, catches typos. For full RFC 5322 compliance use the multi-thousand-character version (you almost never need it).
- For password strength, the included pattern is a "minimum acceptable" check — use the password-strength-checker tool for nuanced scoring.
- Regex is great for validation, terrible for parsing. Use a dedicated parser for HTML, JSON, dates with timezones, etc.
- JavaScript regex doesn't support recursive patterns — for nested-bracket matching, use a real parser.
- For multi-line input, set the `m` flag so `^` / `$` match line starts/ends, and the `s` flag to make `.` match newlines.
FAQ
Are these regex patterns production-ready?
These patterns cover common use cases and are suitable for most applications. For critical validation, consider edge cases specific to your requirements.
What regex flavor are these patterns?
These patterns use JavaScript-compatible regex syntax, which works across most modern programming languages with minimal modifications.
Is this tool free to use?
Yes, this tool is completely free with no registration required. There are no usage limits, no premium tiers, and no hidden costs.
Is my data safe and private?
Absolutely. All processing happens locally in your browser. No data is ever sent to our servers or any third party.
Does this tool work offline?
Once the page is loaded, the tool works entirely in your browser without requiring an internet connection.