Date - Extract & Validate - Fully tested - Format YYYY-MM-DD (dynamic parts separator / can use a different separator)

Published on Tue Mar 01 2022

A fully tested regex that extracts and validates date parts using named capturing groups. \ **Validations:** - Year must be preceded by nothing or a non-digit character - Year must have 4 digits - Month must be between 01 and 12 - Month must have 2 digits - Day must be between 01 and the maximum number of days for the month (e.g. february can't have more than 29 days) - Day must have 2 digits - Day must be followed by nothing or a non-digit character - Separator must be any single character that is not a space or an alphanumeric character - Separator must be the same between each date part \ **Capturing groups:** ```plain | # | Name | Description | |:-:|:-------:|-------------------------------------| | 1 | `year` | 4 digits of the year | | 2 | `sep` | Date parts separator | | 3 | `month` | 2 digits of the month | | 4 | `day` | 2 digits of the date (day of month) | ``` \ **Example usage:** ```js let match = regex.exec('2020-11-22') console.log('year: %s, month: %s, day: %s', match.groups.year, match.groups.month, match.groups.day) // year: 2020, month: 11, day: 22 ``` \ **Compatibility:** _(updated 2020-11-20)_ - Chrome >= 64 - Edge >= 79 - Firefox >= 78 - IE incompatible (lookbehind assertions & named capture groups not supported) - Opera >= 51 - Safari incompatible (lookbehind assertions not supported) - NodeJS >= 10.0.0 See [regex compatibility table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Browser_compatibility). \ _**Note:** does not validate leap years (not really possible in regex)_

Additional matching regexes for
Date - Extract & Validate - Fully tested - Format YYYY-MM-DD (dynamic parts separator / can use a different separator)

Date - Extract & Validate - Fully tested - Format YYYY-MM-DD (dynamic parts separator / can use a different separator)

A fully tested regex that extracts and validates date parts using named capturing groups. \ **Validations:** - Year must be preceded by nothing or a non-digit character - Year must have 4 digits - Month must be between 01 and 12 - Month must have 2 digits - Day must be between 01 and the maximum number of days for the month (e.g. february can't have more than 29 days) - Day must have 2 digits - Day must be followed by nothing or a non-digit character - Separator must be any single character that is not a space or an alphanumeric character - Separator must be the same between each date part \ **Capturing groups:** ```plain | # | Name | Description | |:-:|:-------:|-------------------------------------| | 1 | `year` | 4 digits of the year | | 2 | `sep` | Date parts separator | | 3 | `month` | 2 digits of the month | | 4 | `day` | 2 digits of the date (day of month) | ``` \ **Example usage:** ```js let match = regex.exec('2020-11-22') console.log('year: %s, month: %s, day: %s', match.groups.year, match.groups.month, match.groups.day) // year: 2020, month: 11, day: 22 ``` \ **Compatibility:** _(updated 2020-11-20)_ - Chrome >= 64 - Edge >= 79 - Firefox >= 78 - IE incompatible (lookbehind assertions & named capture groups not supported) - Opera >= 51 - Safari incompatible (lookbehind assertions not supported) - NodeJS >= 10.0.0 See [regex compatibility table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Browser_compatibility). \ _**Note:** does not validate leap years (not really possible in regex)_

Valid RGB color value

Pattern for matching actually valid RGB values. - validate separator (mixing spaces and commas between values is not valid) - validate if comma is used as separator if alpha channel is set - validate units (mixing percentage with integers is not valid) - extract `r`, `g`, `b`, `a`, `separator` and `unit` with named groups

Extract URL parts only named capturing groups

Extract URL parts only named capturing groups

Timecode

Regex to match standard timecode format. (Updated with fewer groups).

Matching decimals in european format (dot as grouping separator, comma as decimal separator)

A regex for validating decimal numbers in the European number format (in many parts of Europe at least, including Germany). A comma is used as a separator for the decimal number, a dot as a separator for thousand places.

How to limit total number of characters of match

I need to match a pattern as follows with the added limitation that the match must be exactly 7 characters long: /^\d*[a-zA-Z]\d*$/ In words, this is a 7 character sequence of 6 digits and one alphabetic character in any order. How do I limit the overall length to 7 using regex? Thanks!

CSV line parsing

Captures all fields from a CSV file's line. Can be customized with user-defined field separator and protecting character.

Date: DD-MM-YYYY hh:mm:ss

Validate and capture dateTime parts, includes validation for leap years, range 1000-2999. Fixed bug

Match numbers with consecutive digits

Match numbers with consecutive digits and of length 3.

Password stronger

**This regex will validate your password** To be stronger, the password must be contain: - At least 8 characters - At least 1 number - At least 1 lowercase character (a-z) - At least 1 uppercase character (A-Z) - At least 1 special character (! @ # $) I hope I've helped :)