Please enable JavaScript to use regex101
Regular
Expressions
101
Support Regex101
Social
Info
Regex Editor
Community Patterns
Account
Regex Quiz
Order By
Most Recent
Most upvotes
Most downvotes
Highest Score
Lowest Score
Relevance
Filter by Flavor
PCRE2 (PHP)
JavaScript
Python
Golang
Java
.NET 7.0 (C#)
Rust
PCRE (Legacy)
Sponsors
digidib · when security, quality, and reliability matter
Community Patterns
Search among community submitted regex patterns...
0/512
13
Conventional Commits validation
Created
·
2022-01-03 20:30
Updated
·
2022-04-05 20:20
Flavor
·
Python
This regex prevents the writing of non-standard conventional commits. I'm available on my github
Submitted by
Krisque
6
Quartz Cron Validation
Created
·
2015-07-27 12:13
Flavor
·
PCRE (Legacy)
http://stackoverflow.com/questions/2362985/verifying-a-cron-expression-is-valid-in-java
Submitted by
anonymous
14
Email regex validation
Created
·
2019-03-17 21:49
Updated
·
2023-07-27 21:03
Flavor
·
JavaScript
RegEx email /^((?!\.)[\w-_.]*)(@\w+)(\.\w+(\.\w+)?)$/gim; Just playing with Reg Ex. This to validate emails in following ways The email couldn't start or finish with a dot The email shouldn't contain spaces into the string The email shouldn't contain special chars ( mailname@domain.com First group takes the first string with the name of email \$1 => (mailname) Second group takes the @ plus the domain: \$2 => (@domain) Third group takes the last part after the domain : \$3 => (.com)
Submitted by
https://www.linkedin.com/in/peralta-steve-atileon/
87
Password Validation
Created
·
2015-07-08 18:46
Flavor
·
JavaScript
Checks that a password has a minimum of 6 characters, at least 1 uppercase letter, 1 lowercase letter, and 1 number with no spaces.
Submitted by
Christian Klemp
19
Date: DD-MM-YYYY hh:mm:ss
Created
·
2013-05-17 13:07
Flavor
·
PCRE (Legacy)
Recommended
·
Validate and capture dateTime parts, includes validation for leap years, range 1000-2999. Fixed bug
Submitted by
Ka.
4
Credit Card Validation - MasterCard, Visa, Amex, Discover
Created
·
2016-07-09 21:06
Flavor
·
PCRE (Legacy)
MasterCard - ^5[1-5]\d+ Visa - ^4\d+ Amex - ^3[47]\d+ Discover - 6011|65|64...
Submitted by
Eric Foster
4
DNS hostname well-formedness validation
Created
·
2016-03-10 19:44
Flavor
·
PCRE (Legacy)
Validates that a DNS hostname is well-formed only. You will still need to check that the overall length of the hostname, including the implied trailing "." (if not present), does not exceed 255 bytes.
Submitted by
Jeff Walter
4
JWT Validation
Created
·
2016-01-06 09:29
Flavor
·
PCRE (Legacy)
Validate a Json Web Token (JWT).
Submitted by
Erik Maas
11
Address Check Validation
Created
·
2014-01-30 13:56
Flavor
·
PCRE (Legacy)
Check for true or false street address format
Submitted by
Dilip Borad
18
Email validation
Created
·
2014-09-16 13:45
Flavor
·
PCRE (Legacy)
no description available
Submitted by
tutsplus.com
7
PAN CARD validation
Created
·
2014-05-06 07:06
Flavor
·
PCRE (Legacy)
checks for valid PAN card for Indian users.
Submitted by
karan thakkar
5
Password strength
Created
·
2015-08-20 14:32
Flavor
·
JavaScript
Regular expression for password validation Rules: 8-120 chars no spaces must contain at least one a-z char must contain at least one A-Z char must contain at least one digit must contain at least one of the folowing chars: !@#$%^&*()-=¡£_+`~.,/?;:'\"|[]{}
Submitted by
@razvanz
3
Caltrans EA validation with optional XX-XXXXXX entry and C##-#????#
Created
·
2023-04-07 19:11
Updated
·
2023-04-07 19:51
Flavor
·
.NET 7.0 (C#)
Checks validity of an EA number first two digits 01-12 followed by hyphen then a number from 0-4 and then 4 numbers or uppercase letters and ending in a 1 or 4 for example "05-1J7601". Adding a capital C to the beginning is also accepted "C05-1J7601", along with the entry of 2 X's hyphen and 6 X's "XX-XXXXXX"
Submitted by
RDJ@Ct
3
Email
Created
·
2021-03-20 22:30
Flavor
·
JavaScript
This is a bit simpler version that is still quite robust. It was taken from a Formik example.
Submitted by
codefinity
3
Hostname validation
Created
·
2017-01-29 01:16
Flavor
·
Golang
Validates subdomain, root domain, and wild card domains
Submitted by
AnonymousDapper
3
Forum user validation
Created
·
2015-09-03 10:07
Flavor
·
PCRE (Legacy)
Pedro al DAMS
Submitted by
giacomo
7
Date validation
Created
·
2015-07-24 11:21
Flavor
·
JavaScript
Besides leap year handling, this takes care of date validation in the yy-mm-dd format.
Submitted by
anonymous
5
ipv6 Validation
Created
·
2015-09-04 16:46
Flavor
·
PCRE (Legacy)
Handle all condition for ipv6 example: 1) FE80::8329 2) FE80::FFFF:8329 3) FE80::B3FF:FFFF:8329 4) FE80::0202:B3FF:FFFF:8329 5) FE80::0000:0202:B3FF:FFFF:8329 6) FE80::0000:0000:0202:B3FF:FFFF:8329 7) FE80:0000:0000:0000:0202:B3FF:FFFF:8329
Submitted by
Lim Yew Teck, Nicholas
4
IPV4 address validation using recursion
Created
·
2015-06-09 14:53
Flavor
·
PCRE (Legacy)
Validate IPv4 addresses using PCRE's recursion patterns. A shorter but less efficient alternative to https://regex101.com/r/wZ6oY5/1
Submitted by
Captain Haddock
3
strong password validation
Created
·
2017-07-04 03:44
Flavor
·
PCRE (Legacy)
This regex matches only when all the following are true: password has minimum 2 uppercase letters password has minimum 2 lowercase letters password has minimum 2 numerals (0-9) password has minimum 2 special characters, of the group !@#$%^&*()-_=+{};:, password has no more than 2 consecutive identical characters password is composed of 12 to 20 characters belonging ONLY to the above character classes (i.e., no whitespace)
Submitted by
anonymous
3
IPv4 validation
Created
·
2016-04-19 00:12
Flavor
·
JavaScript
validate an IP v4
Submitted by
harimambura
3
ISO 8601 date
Created
·
2014-11-26 23:50
Flavor
·
PCRE (Legacy)
Validates a date with ISO 8601 format. Source: http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
Submitted by
anonymous
2
Secure Email Validation (OWASP-Aligned & DNS-Strict) (RFC 5322)
Created
·
2026-01-21 16:32
Updated
·
2026-01-21 16:36
Flavor
·
JavaScript
This regular expression provides a balance between RFC compliance and security-best-practices. It is designed to prevent injection vectors in legacy systems by using a restricted "safe" character subset recommended by the OWASP Validation Regex Repository. Pattern: ^A-Za-z0-9(?:\.A-Za-z0-9_+&-]+)*@(?:[A-Za-z0-9{0,61}[A-Za-z0-9])?\.)+[A-Za-z]{2,63}$ Key Features: Forced Alphanumeric Start: Prevents leading hyphens to avoid command injection vulnerabilities. Security Subset: Restricts special characters to _+&*- to prevent exotic character injections (e.g., pipes or backticks). No Quoted Strings: Forbids quoted strings to eliminate dangerous payloads containing spaces or backslashes. DNS Compliance: Enforces label lengths (1–63 characters) and prevents labels from starting or ending with hyphens. Whole String Anchoring: Uses ^ and $ to ensure the entire input is validated.
Submitted by
Gor Sargsyan
2
Quartz CRON Validation with groups
Created
·
2024-02-06 08:27
Flavor
·
JavaScript
CRON validation Validates CRON pattern (Quartz) and supports groups. Useful for e.g. typescript or other typed languages. The following greoups are covered: second minute hour day of month month day of week year A group generally consists of START_{GROUP}, DELIMITER_{GROUP} and END_{GROUP} containing the first character of the group, the used delimiter (generally ,,-,/) and the last character. If a group has a delimiter (typeof DELIMITER_{GROUP} !== "undefined") you can split a complete group into an array by using the groups delimiter on the group string. Example const cronregex = cronstring.match(regex); //this regex string const regexgroups = cronregex.groups as RegexGroups; //custom stype const secondsarray = regexgroups.SECOND.split(regexgroups.DELIMITER_SEC); //every character as array item More information: https://docs.openinc.dev/docs/opendash-core/overview
Submitted by
Nico Vitt
2
Quartz .NET Cron Schedule Validation
Created
·
2023-11-03 04:14
Updated
·
2023-11-03 04:19
Flavor
·
PCRE2 (PHP)
Matches a list of cron expressions which are valid in the Quartz .NET library Quartz Net Cron Expression
Submitted by
Michael Robertson
2
Pattern for usual email address
Created
·
2022-03-22 11:51
Flavor
·
PCRE2 (PHP)
Intentionally leaves out weird stuff such as IPV4 or IPV6 for the domain part and quoted usernames with invalid chars in the addressee part. Handles internationalized domains with soft validation (only structural matching) and blocks domain parts starting or ending with dashes or containing double dashes (except in xn-- internationalization prefix).
Submitted by
Victor Schröder
2
Eircode
Created
·
2016-09-19 14:19
Flavor
·
PCRE (Legacy)
Eircode validation for new postcodes identifiers in Republic of Ireland. Case-insensetive for easier user input. Added optional space separator to follow same pattern as in UK post codes and in examples used in eircode spec.
Submitted by
Arek Jaworski
2
Email validation
Created
·
2016-06-20 23:08
Flavor
·
PCRE (Legacy)
It validates an email address with alias
Submitted by
anonymous
2
Password Validation
Created
·
2016-02-03 13:16
Flavor
·
Python
Checks for password containing at least 1 Upper case, 1 lower case, 1 digit and 1 special character, all together with a length of at least 8. (This pattern allows any order of the requried elements, other than what was been distributed here before)
Submitted by
Tom Spielvogel
2
file extension validation
Created
·
2016-01-07 19:04
Flavor
·
JavaScript
no description available
Submitted by
Lisa
2
uri template validation
Created
·
2015-12-03 08:25
Flavor
·
PCRE (Legacy)
validating uri template
Submitted by
Tirta Wijaya
2
US City Validation
Created
·
2015-11-16 20:42
Flavor
·
JavaScript
United States City name validation
Submitted by
Jagadesh
2
Argentine postal code validation
Created
·
2015-11-12 18:11
Flavor
·
Python
validation for Argentina postal codes, previous four digits + new CPA
Submitted by
jpaulini
2
credit card
Created
·
2015-07-25 03:39
Flavor
·
PCRE (Legacy)
Based on http://www.regular-expressions.info/creditcard.html This example includes test strings. This only validates the pattern, and not whether the credit card number passes a checksum validation. See the Luhn algorithm for details https://en.wikipedia.org/wiki/Luhn_algorithm For an implementation in Lasso, see https://github.com/stevepiercy/sp_valid_creditcard
Submitted by
Steve Piercy
1
IPv4&IPv6 URL validation regular expression
Created
·
2014-04-24 04:15
Flavor
·
PCRE (Legacy)
no description available
Submitted by
Henry Li
2
Url with <a> (param) validation
Created
·
2014-05-06 04:14
Flavor
·
PCRE (Legacy)
https://www.google.com http://www.google.net/hello https://www.google. http://www.google./hello above url matching with given regex
Submitted by
Duleep Dissanayaka
2
US and Canada Regex
Created
·
2014-02-10 20:36
Flavor
·
JavaScript
A zipcode regex for validation of both US and Canada
Submitted by
Kyle M.
1
Date-Validation with mm/dd/yyyy or mmddyyyy or mm-dd-yyyy or m/d/yyyy
Created
·
2015-08-12 19:32
Flavor
·
JavaScript
Date Validation with leap year handling, & it takes care of date validation in the format like :mm/dd/yyyy or mmddyyyy or mm-dd-yyyy or m/d/yyyy or m-d-yyyy. 12/01/1986 02/29/2016 02/29/2015 13/31/1986 12/31/1980 1/32/2015 1/31/2015 01012016 01/01/2016 1/1/2016 1/1/16 01/01/16 01-01-2016 1-1-2016 1-1-16 01-01-16
Submitted by
Ashish
2
PO Box Address Validation
Created
·
2014-12-09 21:16
Flavor
·
PCRE (Legacy)
no description available
Submitted by
mrferos
2
Email validation
Created
·
2014-11-11 21:35
Flavor
·
JavaScript
Very crude, but effective email validation.
Submitted by
Ryan Oaks
1
dd/mm/yyyy validation regexp
Created
·
2015-09-17 10:54
Flavor
·
Python
no description available
Submitted by
uknnown
1
IP v4 format validation
Created
·
2015-05-12 09:48
Flavor
·
PCRE (Legacy)
Valid 0.0.0.0 1.1.1.1 101.101.101.101 255.255.255.255 156.0.1.10
Submitted by
NexRezzo
0
Fully Qualified Domain Name FQDN
Created
·
2015-06-24 20:11
Flavor
·
PCRE (Legacy)
Fully qualified domain name validation
Submitted by
ximbs
1
one decimal validation
Created
·
2015-09-10 20:39
Flavor
·
JavaScript
this regular expression allow numbers with one number from 1 to 5 and only one decimal value Onlys accept numeric values from 1.0 to 5
Submitted by
anonymous
-1
UK Postcode Validation
Created
·
2015-04-10 22:38
Flavor
·
JavaScript
Matches all valid, current UK Postcodes, including Girobank and non-geographic postcodes, irrespective of whether they contain a space. It does not include overseas territories. Adapted from the BS7666 postcode rules at http://www.cabinetoffice.gov.uk/govtalk/schemasstandards/e-gif/datastandards/address/postcode.aspx
Submitted by
Ti Marner
-2
Valid Email
Created
·
2015-10-19 17:05
Flavor
·
JavaScript
Use this Regex for server-side validation also with some slight modifications like so for .NET -- @\w+(-+.']\w+)@\w+([-.]\w+)\.[a-zA-Z0-9]{2,6}([-.{2,6})*;
Submitted by
Fred Scales
1
Empty string test
Created
·
2015-11-05 12:58
Flavor
·
PCRE (Legacy)
Regular for testing empty strings for validation purpose
Submitted by
anonymous
1
MM-DD-YYYY - Javascript Date with some validation
Created
·
2015-09-22 17:59
Flavor
·
JavaScript
This is a regular expression for date in javascript. It validates the month between 01-12 (double digits only). It validates the day between 01-31 (double digits only). And enforces 4 digit year (no validation for range).
Submitted by
Andrew Leonenko
1
russian phone number hard validation (multiformat)
Created
·
2015-05-26 13:35
Flavor
·
PCRE (Legacy)
Supported formats (mobile): +7(xxx)xxx xxxx +7(xxx)xxxxxxx +7(xxx)xxx-xx-xx +7(xxx)xxx xx xx +7 xxx xxx xx xx +7 xxx xxx-xx-xx +7xxx xxxxxxx +7 xxx xxx xxxx +7 xxx xxx-xxxx +7xxxxxxxxxx 7(xxx)xxxxxxx 7(xxx)xxx-xx-xx 7(xxx)xxx xx xx (xxx)xxxxxxx (xxx)xxx-xx-xx (xxx)xxx xx xx 7 xxx xxx xx xx 7 xxx xxx-xx-xx 7xxx xxxxxxx 7 xxx xxx xxxx 7 xxx xxx-xxxx 7xxxxxxxxxx xxxxxxxxxx Home phones: ex.: +7(813)78 444-xx +7(xxx)xx xxx-xx +7(xxx)xx xxx xx +7(xxx)xx xxxxx +7xxxxx xxx-xx +7xxxxx xxx xx +7xxxxx xxxxx +7xxx xx xxx xx +7xxx xx xxx-xx +7xxxxxxxxxx 7(xxx)xx xxx-xx 7(xxx)xx xxx xx 7(xxx)xx xxxxx 7xxxxx xxx-xx 7xxxxx xxx xx 7xxxxx xxxxx 7xxx xx xxx xx 7xxx xx xxx-xx 7xxxxxxxxxx xxx-xx xxxxx
Submitted by
Redfern.89
1
Simple Email Validation
Created
·
2014-11-17 08:58
Flavor
·
JavaScript
Does not match everything, but good for a cross-platform validation filter.
Submitted by
anonymous
Load More
Community Library Entry
0
Regular Expression
Created
·
2023-02-06 02:30
Updated
·
2023-02-06 03:11
Flavor
·
JavaScript
/
^
rgba
?
\(
(?:
(?:
(?:
[
0
-
9
]
{1,3}
){2}
[
0
-
9
]
{1,3}
|
(?:
[
0
-
9
]
{1,3}
%
){2}
[
0
-
9
]
{1,3}
%
)(?:
\/
(?:
[
0
-
9
]
{1,3}
%
|
1
|
0
|
0
?
\.
[
0
-
9
]
+
)
)?
|
(?:
(?:
[
0
-
9
]
{1,3}
,
){2}
[
0
-
9
]
{1,3}
|
(?:
[
0
-
9
]
{1,3}
%,
){2}
[
0
-
9
]
{1,3}
%
)(?:
,
(?:
[
0
-
9
]
{1,3}
%
|
1
|
0
|
0
?
\.
[
0
-
9
]
+
)
)?
)
\)
$
/
gm
Open regex in editor
Description
It validates the RGB expression doesn't break the CSS parser.
Submitted by
Martin