CARVIEW |
Select Language
HTTP/2 200
date: Mon, 28 Jul 2025 06:45:55 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"cb2e81887a7e88375c056c712b16b034"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=wce4ws0lS5apKgE32tsObSZSC7tNiCKj4Gk5mM2CSx90jUACRueBmSttjbz5aM8ztPchmvVmpgBPp0zj07UCmJhMAC0Gfwm1k%2BcQzWbCf1jVxsZoFdKNRcvB482l%2BxCcWMGxU1l%2FWhFlCLCJqAsjQBQ7U%2Bw8lFG45FC3ZX2xuRLJUdkrBWOOWsFtw5nZukIGc4%2BW5t9HHH4SBLe7D0cnSDNi%2BWWtpy5IsOMO6qaDjf4A8OXs9SF7Me7ffMEJu1JExz3teXmwkPof26Qwy75nYg%3D%3D--VE8qio%2FNUyjkIKsl--h0%2B9dPgIg3OM%2BKSQkQgqNg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.2115481275.1753685155; Path=/; Domain=github.com; Expires=Tue, 28 Jul 2026 06:45:55 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Tue, 28 Jul 2026 06:45:55 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 82F0:2E9E4D:341672:3F8EE5:68871CA2
Common regex patterns I need to use regularly. Includes things like, meila, phone, url, date and password validating regex. · GitHub
Show Gist options
Save RayaEspi/c189a49d7aebbaf2481b7c00f12d12d7 to your computer and use it in GitHub Desktop.
{{ message }}
Instantly share code, notes, and snippets.
Created
July 28, 2025 01:22
-
Star
0
(0)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save RayaEspi/c189a49d7aebbaf2481b7c00f12d12d7 to your computer and use it in GitHub Desktop.
Common regex patterns I need to use regularly. Includes things like, meila, phone, url, date and password validating regex.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"email": { | |
"pattern": "^[A-Za-z0-9.*%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$", | |
"description": "Matches most conventional email addresses.", | |
"examples": [ | |
"user@example.com", | |
"firstname.lastname@domain.co" | |
] | |
}, | |
"url": { | |
"pattern": "^(https?:\\/\\/)?(?:[\\w-]+\\.)+[\\w-]+(?:\\/[\\w\\-\\.\\*\\~:\\/?#\\[\\]@!$&'()*+,;=]*)?$", | |
"description": "Supports http and https, subdomains, paths, and query strings.", | |
"examples": [ | |
"https://www.example.com", | |
"https://sub.domain.org/path?arg=val" | |
] | |
}, | |
"phone_us": { | |
"pattern": "^\\+?1?[-.\\s]?\\(?([2-9][0-9]{2})\\)?[-.\\s]?([2-9][0-9]{2})[-.\\s]?([0-9]{4})$", | |
"description": "Matches US phone numbers with optional country code, separators, and parentheses.", | |
"examples": [ | |
"123-456-7890", | |
"(123) 456 7890", | |
"+1 123.456.7890" | |
] | |
}, | |
"phone_eu": { | |
"pattern": "^(?:\\+?\\d{1,3})? ?(?:\\(?\\d{1,4}\\)?)?[\\d \\-/]{5,}$", | |
"description": "Matches European phone numbers in international and local formats (E.164 and local dialing).", | |
"examples": [ | |
"+44 20 1234 5678", | |
"020 1234 5678", | |
"+49-89-123456" | |
] | |
}, | |
"ipv4": { | |
"pattern": "^((25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)\\.){3}(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)$", | |
"description": "Validates IPv4 addresses ranging from 0.0.0.0 to 255.255.255.255.", | |
"examples": [ | |
"192.168.0.1", | |
"255.255.255.255" | |
] | |
}, | |
"ipv6": { | |
"pattern": "^([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}$", | |
"description": "Validates full IPv6 addresses (8 groups of 1–4 hex digits).", | |
"examples": [ | |
"2001:0db8:85a3:0000:0000:8a2e:0370:7334", | |
"FE80:0000:0000:0000:0202:B3FF:FE1E:8329" | |
] | |
}, | |
"date_yyyy_mm_dd": { | |
"pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$", | |
"description": "Ensures valid month (01-12) and day (01-31).", | |
"examples": [ | |
"2025-07-28", | |
"1990-01-01" | |
] | |
}, | |
"date_dd_mm_yyyy": { | |
"pattern": "^(0[1-9]|[12]\\d|3[01])-(0[1-9]|1[0-2])-\\d{4}$", | |
"description": "Validates dates in DD-MM-YYYY format with day 01-31 and month 01-12.", | |
"examples": [ | |
"28-07-2025", | |
"01-01-1990" | |
] | |
}, | |
"credit_card": { | |
"pattern": "^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13})$", | |
"description": "Covers Visa, MasterCard, and American Express.", | |
"examples": [ | |
"4111111111111111", | |
"5500000000000004", | |
"341234567890123" | |
] | |
}, | |
"strong_password": { | |
"pattern": "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&#])[A-Za-z\\d@$!%*?&#]{8,}$", | |
"description": "Enforces mixed-case, digits, special chars, and minimum length of 8.", | |
"examples": [ | |
"P@ssw0rd", | |
"Str0ng!Pass" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can’t perform that action at this time.