s2e-lab/RegexEval huggingface dataset:
Date in DD/MM/YYYY format.
Match examples:
- "28/12/2003"
- "28/02/2003"
- "29/02/2000"
Non-match examples:
- "28-02-2003"
- "30/02/2003"
Regular expression: (((0[1-9]|[12][0-9]|3[01])([/])(0[13578]|10|12)([/])(\d{4}))|(([0][1-9]|[12][0-9]|30)([/])(0[469]|11)([/])(\d{4}))|((0[1-9]|1[0-9]|2[0-8])([/])(02)([/])(\d{4}))|((29)(\.|-|\/)(02)([/])([02468][048]00))|((29)([/])(02)([/])([13579][26]00))|((29)([/])(02)([/])([0-9][0-9][0][48]))|((29)([/])(02)([/])([0-9][0-9][2468][048]))|((29)([/])(02)([/])([0-9][0-9][13579][26])))
Matches number in format XX.XX Please note that this expression allows maximum of 8 digits before the dot and 2 (optional) digits after the dot.
Match examples:
- "1.00"
- "2345"
- "332.3"
Non-match examples:
- ".00"
- "23333333333.00"
Regular expression: (^[0-9]{1,8}|(^[0-9]{1,8}\.{0,1}[0-9]{1,2}))$
Simple match for U.S. Amateur Radio Call signs
Must start with an A,K,N or W.
1 or two prefix letters (not case sensitive),
Exactly one zone digit,
One to three suffix digits( not case sensitive).
Match examples:
- "kd6dun"
- "W9OXZ"
- "kb8ae"
Non-match examples:
- "kdd90bz"
- "de7bgw"
Regular expression: ^[AaWaKkNn][a-zA-Z]?[0-9][a-zA-Z]{1,3}$
This RE matches Days of the week or their abbreviations.
Match examples:
- "Sunday"
- "Mon"
- "Tu"
Non-match examples:
- "day"
- "Wedday"
Regular expression: ^(Sun|Mon|(T(ues|hurs))|Fri)(day|\.)?$|Wed(\.|nesday)?$|Sat(\.|urday)?$|T((ue?)|(hu?r?))\.?$
matches a wide range of text strings that have at least one word character((letters, digits, or underscores) at the beginning.
Match examples:
- "user name"
- "o)(=-&amp;r443*/"
- "fds2f"
Non-match examples:
- "=stuff"
- ".username"
Regular expression: ^\w+.*$
Matches ANSI SQL date format YYYY-mm-dd hh:mi:ss am/pm. You can use / - or space for date delimiters, so 2004-12-31 works just as well as 2004/12/31. Checks leap year from 1901 to 2099.
Match examples:
- "2004-2-29"
- "2004-02-29 10:29:39 pm"
- "2004/12/31"
Non-match examples:
- "2003-2-29"
- "2003-13-02"
Regular expression: ^((\d{2}(([02468][048])|([13579][26]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\s(((0?[1-9])|(1[0-2]))\:([0-5][0-9])((\s)|(\:([0-5][0-9])\s))([AM|PM|am|pm]{2,2})))?$
This validates the states and territories of the United States in a 2 character uppercase format.
Match examples:
- "NY"
- "PA"
- "NJ"
Non-match examples:
- "Pennsylvania"
- "Pa"
Regular expression: ^((AL)|(AK)|(AS)|(AZ)|(AR)|(CA)|(CO)|(CT)|(DE)|(DC)|(FM)|(FL)|(GA)|(GU)|(HI)|(ID)|(IL)|(IN)|(IA)|(KS)|(KY)|(LA)|(ME)|(MH)|(MD)|(MA)|(MI)|(MN)|(MS)|(MO)|(MT)|(NE)|(NV)|(NH)|(NJ)|(NM)|(NY)|(NC)|(ND)|(MP)|(OH)|(OK)|(OR)|(PW)|(PA)|(PR)|(RI)|(SC)|(SD)|(TN)|(TX)|(UT)|(VT)|(VI)|(VA)|(WA)|(WV)|(WI)|(WY))$
It is the exact phone number regular expression for '(###) ###-####'.
Match examples:
- "(555) 555-1212"
- "(575) 609-4178"
- "(435) 236-2754"
Non-match examples:
- "555-1212"
- "1-800-555-1212"
Regular expression: ^([\(]{1}[0-9]{3}[\)]{1}[ ]{1}[0-9]{3}[\-]{1}[0-9]{4})$
Matches variations on date/time/AM-PM. Must have 4 digit year, but everything else is open. Restrictions are: 4 digit year, months 1-12, hours 1-23, minutes and seconds 1-59, any case of AM and PM.
Match examples:
- "12/30/2002"
- "12/30/2002 9:35 pm"
- "12/30/2002 19:35:02"
Non-match examples:
- "18/22/2003"
- "8/12/99"
Regular expression: ^(([0]?[1-9]|1[0-2])/([0-2]?[0-9]|3[0-1])/[1-2]\d{3})? ?((([0-1]?\d)|(2[0-3])):[0-5]\d)?(:[0-5]\d)? ?(AM|am|PM|pm)?$
Matches positive whole numbers from 0-999
Match examples:
- "0"
- "12"
- "876"
Non-match examples:
- "1000"
- "1.23"
Regular expression: ^\d(\d)?(\d)?$
More flexible date validator. Allows either spaces, / or - as dividers, also allows for fully uppercase months, year as 4 digit.
Match examples:
- "01 JAN 2003"
- "31/Dec/2002"
- "20-Apr-2003"
Non-match examples:
- "32 Jan 2003"
- "00 Dec 2003"
Regular expression: ^(3[0-1]|2[0-9]|1[0-9]|0[1-9])[\s{1}|\/|-](Jan|JAN|Feb|FEB|Mar|MAR|Apr|APR|May|MAY|Jun|JUN|Jul|JUL|Aug|AUG|Sep|SEP|Oct|OCT|Nov|NOV|Dec|DEC)[\s{1}|\/|-]\d{4}$
Used for dutch postalcodes; no leading zero. 4 numbers and 2 letters.
Match examples:
- "1234AB"
- "1234 AB"
- "1234 ab"
Non-match examples:
- "0123AB"
- "123AA"
Regular expression: ^[1-9]{1}[0-9]{3}\s{0,1}?[a-zA-Z]{2}$
Matches any single character that is either a whitespace character (\s), a plus sign (+), or a comma (,). It's a character class that includes these three specific characters.
Match examples:
- ","
- "whitespace"
- "carrage returns"
Non-match examples:
- "cat"
- "jioj"
Regular expression: [\\s+,]
This RE validate Dates in the MMM dd, yyyy format from Jan 1, 1600 to Dec 31, 9999. The format is as follows: The name or 3 letter abbreivation, without a period, of the month, then a space then the day value then a comma then a space finally the year. The correct number of day are validated for each month include leap years. The name of month is case sensitive.
Match examples:
- "Jan 1, 2003"
- "February 29, 2004"
- "November 02, 3202"
Non-match examples:
- "Feb 29, 2003"
- "Apr 31, 1978"
Regular expression: ^(?:(((Jan(uary)?|Ma(r(ch)?|y)|Jul(y)?|Aug(ust)?|Oct(ober)?|Dec(ember)?)\ 31)|((Jan(uary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sept|Nov|Dec)(ember)?)\ (0?[1-9]|([12]\d)|30))|(Feb(ruary)?\ (0?[1-9]|1\d|2[0-8]|(29(?=,\ ((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))))\,\ ((1[6-9]|[2-9]\d)\d{2}))
This RE validates dates in the dd MMM yyyy format. Spaces separate the values.
Match examples:
- "31 January 2003"
- "29 March 2004"
- "29 Feb 2008"
Non-match examples:
- "Jan 1 2003"
- "31 Sept 2003"
Regular expression: ^((31(?!\ (Feb(ruary)?|Apr(il)?|June?|(Sep(?=\b|t)t?|Nov)(ember)?)))|((30|29)(?!\ Feb(ruary)?))|(29(?=\ Feb(ruary)?\ (((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\d|2[0-8])\ (Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\b|t)t?|Nov|Dec)(ember)?)\ ((1[6-9]|[2-9]\d)\d{2})$
This RE validate the full name of the months.
Match examples:
- "January"
- "May"
- "October"
Non-match examples:
- "Jan"
- "Septem"
Regular expression: ^(?:J(anuary|u(ne|ly))|February|Ma(rch|y)|A(pril|ugust)|(((Sept|Nov|Dec)em)|Octo)ber)$
A simple regular expression to determine if a subnet mask is contiguous; that is, the submask must start with a 1 bit followed by 0 or more 1 bits, followed by 1 or more 0 bits until the end of the submask.
Match examples:
- "10"
- "110"
- "1100"
Non-match examples:
- "0"
- "01"
Regular expression: ^1+0+$
dd/MM/yyyy with leap years integrated
Valid years : from 1600 to 9999
Match examples:
- "29/02/2000"
- "30/04/2003"
- "01/01/2003"
Non-match examples:
- "29/02/2001"
- "30-04-2003"
Regular expression: ^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((1[6-9]|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((1[6-9]|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((1[6-9]|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$
Validates numbers with up to five digits, including optional decimal places with one or two decimal digits.
Match examples:
- "12345.67"
- "0"
- "0.1"
Non-match examples:
- "123456.78"
- "123456.789"
Regular expression: ^\d{1,5}(\.\d{1,2})?$
this regular expression validates numbers with up to five digits, including optional decimal places with one or two decimal digits, while excluding inputs that consist solely of zeros or zero decimals.
Match examples:
- "12345.12"
- "0.5"
- "7"
Non-match examples:
- "123456.12"
- "1.234"
Regular expression: (?!^0*$)(?!^0*\.0*$)^\d{1,5}(\.\d{1,2})?$
This regular expression checks if a given string contains only characters other than the specified special characters. If any of these special characters are found in the string, it will not be matched. These characters include < > ` ~ ! / @ \ # } $ % : ; ) ( _ ^ { & * = | ' +.
Match examples:
- "This is a test"
- "fdsjkfsd hkshjdf"
- "hjfds hfjsdkh"
Non-match examples:
- "^&GYGH"
- "<br>"
Regular expression: ^[^<>`~!/@\#}$%:;)(_^{&*=|'+]+$
More permissive than others on the site, this one allows you to let a user enter US phone numbers in the way they most commonly use, without letting them enter non-valid combinations.
Match examples:
- "5551212"
- "614555-1212"
- "(614)555-1212"
Non-match examples:
- "A12-5555"
- "(614-555-1212"
Regular expression: ^([\(]{1}[0-9]{3}[\)]{1}[\.| |\-]{0,1}|^[0-9]{3}[\.|\-| ]?)?[0-9]{3}(\.|\-| )?[0-9]{4}$
Matches a comma-seperated list of year(s).
Match examples:
- "1999,2001,1988"
- "1999"
- "4895"
Non-match examples:
- "0199,1997"
- "0199"
Regular expression: ^([1-9]{1}[0-9]{3}[,]?)*([1-9]{1}[0-9]{3})$
Checks for various date formats, valid months and days, leap years, and different separators. It ensures that the input follows a valid date format and is suitable for date validation in different contexts.
The regular expression matches dates in various formats:

MM/DD/YYYY
MM-DD-YYYY
MM.YYYY/DD
YYYY/MM/DD
YYYY-MM-DD
YYYY.MM.DD
It enforces specific rules for each part of the date:

MM (month) can be 01-12.
DD (day) depends on the month and can be 01-31.
YYYY (year) must be a four-digit number.
It considers leap years for February (02) by allowing 29 days in certain cases.

It handles different separators between date components (e.g., '-', '/', '.').

It accounts for various scenarios related to leap years, including divisibility by 4, 100, and 400.
Match examples:
- "01/01/2001"
- "02/29-2800"
- "02/29/2108"
Non-match examples:
- "01/01/00000"
- "52/2/54/245"
Regular expression: ^(((0[13578]|10|12)([-./])(0[1-9]|[12][0-9]|3[01])([-./])(\d{4}))|((0[469]|11)([-./])([0][1-9]|[12][0-9]|30)([-./])(\d{4}))|((02)([-./])(0[1-9]|1[0-9]|2[0-8])([-./])(\d{4}))|((02)(\.|-|\/)(29)([-./])([02468][048]00))|((02)([-./])(29)([-./])([13579][26]00))|((02)([-./])(29)([-./])([0-9][0-9][0][48]))|((02)([-./])(29)([-./])([0-9][0-9][2468][048]))|((02)([-./])(29)([-./])([0-9][0-9][13579][26])))$
Regular expression for US (ZIP and ZIP+4) and Canadian postal codes. It allows 5 digits for the first US postal code and requires that the +4, if it exists, is four digits long. Canadain postal codes can contain a space and take form of A1A 1A1. The letters can be upper or lower case, but the first letter must be one of the standard Canadian zones: A,B,C,E,G,H,J,K,L,M,N,P,R,S,T,V,X,Y.
Match examples:
- "00501"
- "84118-3423"
- "n3a 3B7"
Non-match examples:
- "501-342"
- "123324"
Regular expression: ^((\d{5}-\d{4})|(\d{5})|([AaBbCcEeGgHhJjKkLlMmNnPpRrSsTtVvXxYy]\d[A-Za-z]\s?\d[A-Za-z]\d))$
This expression validates for valid C# or C++ identifier
Match examples:
- "_12ffsd"
- "abcd123"
- "abcd_23232"
Non-match examples:
- "..//"
- "..13e232"
Regular expression: ^[a-zA-Z_]{1}[a-zA-Z0-9_]+$
This will match single number, the first block [1346] checks for single digits of 1, 3, 4 or 6, could easily by [1-5] as well. The second block [10] checks for 10 only. This matches inclusively.
Match examples:
- "1"
- "4"
- "10"
Non-match examples:
- "13"
- "2"
Regular expression: ^[1]$|^[3]$|^[4]$|^[6]$|^[1]0$
matches a single uppercase letter from the set {A, C, D, F, H, K, L, M, O, P}.
Match examples:
- "A"
- "F"
- "P"
Non-match examples:
- "a"
- "b"
Regular expression: ^[A]$|^[C]$|^[D]$|^[F]$|^[H]$|^[K]$|^[L]$|^[M]$|^[O]$|^[P]$
This regex pattern is designed to match a numeric value that can be either a positive integer, a positive decimal number, zero, or a positive decimal number less than 1 with up to two decimal places. It allows for an optional minus sign at the beginning to indicate negative numbers.
Match examples:
- "123"
- "123.54"
- "-.54"
Non-match examples:
- "123.543"
- "0012"
Regular expression: ^[-]?([1-9]{1}[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|\.[0-9]{1,2})$
This regex pattern matches HTML/XML tags by looking for text enclosed in angle brackets (< and >), allowing for any characters ([^>]*) between them.
Match examples:
- "<html>"
- "<div>"
- "<a href="https://www.example.com">"
Non-match examples:
- "abc"
- "2fed2"
Regular expression: <[^>]*>
Match italian telephone number with prefix followed by &quot;/&quot;, &quot;-&quot; or blank and number.
Match examples:
- "02-343536"
- "02/343536"
- "02 343536"
Non-match examples:
- "02a343536"
- "02+343536"
Regular expression: ^([0-9]*\-?\ ?\/?[0-9]*)$
Tests for all numbers OR all letters (upper or lower case)
Match examples:
- "aaaaadddaaaaa"
- "1166633337"
- "48956"
Non-match examples:
- "1n"
- "ppppp99"
Regular expression: ^(\d+|[a-zA-Z]+)$
This regex pattern matches URLs that end with ".com/" followed by one or more digits. It captures the digits at the end of the URL.
Match examples:
- "http://aspalliance.com/123"
- "www.aspalliance.com/123"
- "http://aspalliance.com/34"
Non-match examples:
- "http://aspalliance.com/article.aspx?id=123"
- "http://aspalliance.com/"
Regular expression: \.com/(\d+)$
US Zip Code + 4 digit extension Postal Code
Match examples:
- "14467"
- "144679554"
- "14467-9554"
Non-match examples:
- "14467 955"
- "14467-"
Regular expression: ^[0-9]{5}([- /]?[0-9]{4})?$
Match HTML-like tags in a text, including both opening and closing tags.
Match examples:
- "<td class="TD2">"
- "<!-- comment -->"
- "</table>"
Non-match examples:
- "19-Fev-2002 - 19h00"
- "New Changes :"
Regular expression: <([^<>\s]*)(\s[^<>]*)?>
Match strings that start with the names "Bob," "John," or "Mary" and do not end with "White."
Match examples:
- "Bob Jones"
- "John Smith"
- "Mary Jane Smith"
Non-match examples:
- "Bob White"
- "Mary Doe White"
Regular expression: ^((Bob)|(John)|(Mary)).*$(?<!White)
The RE match U.S. state abbreviation used by the U.S. Post Office.
Match examples:
- "AL"
- "CA"
- "AA"
Non-match examples:
- "New York"
- "California"
Regular expression: ^(?-i:A[LKSZRAEP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$
This pattern match italian fiscal code.
Match examples:
- "SPGGRG73A02E625S"
- "czzdll74h18f205w"
- "RpiOQG61R03w469G"
Non-match examples:
- "SP6FFFF3A02E625S"
- "czzdll74h18f205"
Regular expression: ^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$
Time off hours edit for quarter hour(s) less than eight.
Match examples:
- "0.25"
- "7.75"
- "8"
Non-match examples:
- "8.25"
- "7.15"
Regular expression: ^(([8]))$|^((([0-7]))$|^((([0-7])).?((25)|(50)|(5)|(75)|(0)|(00))))$
Matching : dd/MM/yy
Leap years compatible
Match examples:
- "31/12/75"
- "29/02/00"
- "29/02/04"
Non-match examples:
- "01/13/01"
- "29/02/01"
Regular expression: ^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/(\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/(\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/(\d{2}))|(29\/02\/((0[48]|[2468][048]|[13579][26])|(00))))$
This regular expression matches on postive whole numbers and 0. Whole numbers that are left padded with 0's are not a match.
Match examples:
- "12"
- "0"
- "1200"
Non-match examples:
- "-12"
- "0012"
Regular expression: ^(0)$|^([1-9][0-9]*)$
Percentage (From 0 to 100)
Match examples:
- "100%"
- "100"
- "52.65%"
Non-match examples:
- "-1"
- "-1%"
Regular expression: ^(0*100{1,1}\.?((?<=\.)0*)?%?$)|(^0*\d{0,2}\.?((?<=\.)\d*)?%?)$
Matches on MMDDYYYY only, requires all 8 digits
Match examples:
- "01012003"
- "02292000"
- "02297352"
Non-match examples:
- "01/01/2003"
- "52/2/54/245"
Regular expression: ((^(10|12|0?[13578])(3[01]|[12][0-9]|0?[1-9])((1[8-9]\d{2})|([2-9]\d{3}))$)|(^(11|0?[469])(30|[12][0-9]|0?[1-9])((1[8-9]\d{2})|([2-9]\d{3}))$)|(^(0?2)(2[0-8]|1[0-9]|0?[1-9])((1[8-9]\d{2})|([2-9]\d{3}))$)|(^(0?2)(29)([2468][048]00)$)|(^(0?2)(29)([3579][26]00)$)|(^(0?2)(29)([1][89][0][48])$)|(^(0?2)(29)([2-9][0-9][0][48])$)|(^(0?2)(29)([1][89][2468][048])$)|(^(0?2)(29)([2-9][0-9][2468][048])$)|(^(0?2)(29)([1][89][13579][26])$)|(^(0?2)(29)([2-9][0-9][13579][26])$))
Positive Whole number matched from 0 to 9999999. Only 7 digits length is allowed.
Match examples:
- "1234567"
- "9999999"
- "1"
Non-match examples:
- "12345678"
- "9999.99"
Regular expression: ^\d{1,7}$
This tests an input string for only a-z and A-Z and only allows underscores, hyphens and spaces. The purpose is to force users to generate legitimate, readable file names that can be streamed from the web.
Match examples:
- "123Testing"
- "123_Testing"
- "123-Testing This"
Non-match examples:
- "!@#Testing"
- "Testing &quot;This&quot;"
Regular expression: ^[a-zA-Z0-9_\s-]+$
Best Use validation to accept a valid &quot;MonthName(,) Year&quot;.
It can validate an entry with or without comma (,).
Match examples:
- "January 2004"
- "Jan, 2004"
- "january 2003"
Non-match examples:
- "Janu 2004"
- "jAn, 2004"
Regular expression: ^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\,*\s\s*\d{4}$|^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\,*\s\d{4}$|^(January|February|March|April|May|June|July|August|September|October|November|December)\,*\s\d{4}$|^(january|february|march|april|may|june|july|august|september|october|november|december)\,*\s\d{4}$
This allows you to validate first names and last names in seperate fields. Instead of validating a full name in one field.
Match examples:
- "Sameul"
- "O'Conner"
- "Mary-Kate"
Non-match examples:
- "David Bugel"
- "Robert1"
Regular expression: ^[a-zA-Z]+(([\'\,\.\-][a-zA-Z])?[a-zA-Z]*)*$
Matches the 216 web colors with or without the '#' sign.
Match examples:
- "#FFFFFF"
- "FFCC00"
- "003300"
Non-match examples:
- "#FFFFF"
- "EFCC00"
Regular expression: ^#?(([fFcC0369])\2){3}$
Matches a Julian date in the format YYDDD. Two digit year followed by a number from 1 - 366 indicating the day of the year.
Match examples:
- "99366"
- "00001"
- "04225"
Non-match examples:
- "74000"
- "04367"
Regular expression: ^([0-9]{2})(00[1-9]|0[1-9][0-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-6])$
This regex validates U.S. social security numbers, within the range of numbers that have been currently allocated.
Match examples:
- "078-05-1120"
- "078 05 1120"
- "078051120"
Non-match examples:
- "987-65-4320"
- "000-00-0000"
Regular expression: ^(?!000)([0-6]\d{2}|7([0-6]\d|7[012]))([ -]?)(?!00)\d\d\3(?!0000)\d{4}$
Matches positive whole numbers with exactly zero or two decimal points if a . is present. Useful for checking currency amounts, such 5 or 5.00 or 5.25.
Match examples:
- "1"
- "1.23"
- "1234.45"
Non-match examples:
- "a1.34"
- "1.23a"
Regular expression: ^\d+(?:\.\d{0,2})?$
To detect non-alphanumeric characters (for new username/password validation)
Match examples:
- "!@#$"
- "%^&amp;*"
- "'&gt;&lt;?.,&quot;"
Non-match examples:
- "ABC123abc"
- "abc123ABC"
Regular expression: [^A-Za-z0-9]
Validates date format by DD MMM YYYY. Validates days for each month also.
Ensures that month is uppercase.
Match examples:
- "09 MAY 1981"
- "28 JAN 2004"
- "8 JUL 2006"
Non-match examples:
- "29 FEB 2003"
- "28 Oct 2000"
Regular expression: ^((31(?! (FEB|APR|JUN|SEP|NOV)))|((30|29)(?! FEB))|(29(?= FEB (((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\d|2[0-8]) (JAN|FEB|MAR|MAY|APR|JUL|JUN|AUG|OCT|SEP|NOV|DEC) ((1[6-9]|[2-9]\d)\d{2})$
matches 0 and all positive integers only. will accept comma formatting only.
Match examples:
- "1234"
- "1,234"
- "1,234,567"
Non-match examples:
- "1234.0"
- "-1234"
Regular expression: ^(\d|,)*\d*$
String formater matching.
Match examples:
- "The quick {0} fox {1} over the lazy dog."
- "r{6}"
- "k{0}"
Non-match examples:
- "The {b} is wrong"
- "52/2/54/245"
Regular expression: .\{\d\}
Integer numbers with decimals. Only positives match. This expression doesn't match numbers with group separators
Match examples:
- "1234,50"
- "0,70"
- ",03"
Non-match examples:
- "1.234,50"
- "-234,50"
Regular expression: ^([0-9]*\,?[0-9]+|[0-9]+\,?[0-9]*)?$
validates numbers, with or without decimal places, and comma 1000 separators.
Match examples:
- "9999999"
- "99999.99999"
- "99,999,999.9999"
Non-match examples:
- "9999."
- "9,99,99999.999"
Regular expression: ^(((\d{1,3})(,\d{3})*)|(\d+))(.\d+)?$
Date validation in the dd/mm/yyyy format for years 1000+ (i.e 999 or 0999 not matching) and taking february leap years into account.
Match examples:
- "12/12/2003"
- "29-02-2004"
- "31-03-1980"
Non-match examples:
- "29/02/2003"
- "31-04-2002"
Regular expression: ((([0][1-9]|[12][\d])|[3][01])[-/]([0][13578]|[1][02])[-/][1-9]\d\d\d)|((([0][1-9]|[12][\d])|[3][0])[-/]([0][13456789]|[1][012])[-/][1-9]\d\d\d)|(([0][1-9]|[12][\d])[-/][0][2][-/][1-9]\d([02468][048]|[13579][26]))|(([0][1-9]|[12][0-8])[-/][0][2][-/][1-9]\d\d\d)
Matches either an explicitly input percentage or dollar amount, variety of formats of currency borrowed from another example on this board. This is useful when you want to prompt the user to specify either dollars or percent using only one field, and want to validate the entered text is one or the other.
Match examples:
- "$1000.00"
- "100%"
- "50%"
Non-match examples:
- "%100"
- ".5%"
Regular expression: (^\$(\d{1,3},?(\d{3},?)*\d{3}(\.\d{1,3})?|\d{1,3}(\.\d{2})?)$|^\d{1,2}(\.\d{1,2})? *%$|^100%$)
Test string to verify it begins with an upper-case letter.
Match examples:
- "Lewis"
- "Edward"
- "Moten"
Non-match examples:
- "lewis"
- "1moten"
Regular expression: ^[A-Z].*$
This pattern matches a decimal value with up to 3 digits after the decimal. Comma is allowed as a thousands separator but not required. N/A is also allowed.
Match examples:
- "405.234"
- "50"
- "213123.456"
Non-match examples:
- "bathreader"
- "this is N/A"
Regular expression: (^N/A$)|(^[-]?(\d+)(\.\d{0,3})?$)|(^[-]?(\d{1,3},(\d{3},)*\d{3}(\.\d{1,3})?|\d{1,3}(\.\d{1,3})?)$)
Validate a comma delimited string of integer between 1 and 99999999. No zero leading.
Match examples:
- "1,2,3455,12345678"
- "23045,34678,2892"
- "1,2,99999999"
Non-match examples:
- "01,234,567"
- "123,0445,3434,"
Regular expression: ^([1-9]{1}[0-9]{0,7})+((,[1-9]{1}[0-9]{0,7}){0,1})+$
Alphanumeric expression with spaces
Match examples:
- "123asd"
- "111 ee11e"
- "223 eeddd23"
Non-match examples:
- "12' ggg"
- "&lt;&gt;dfdg 444"
Regular expression: ^[a-zA-Z0-9\s]+$
A regular expression that validates the any of the new formats of cellular phones numbers in Peru, allows an optional dash in the middle of the number.
Match examples:
- "8874-2544"
- "99106800"
- "84509955"
Non-match examples:
- "6540-9985"
- "77329390"
Regular expression: ^([8-9])([1-9])(\d{2})(-?|\040?)(\d{4})$
This pattern handles currency including the following:
- optional period with two or more digits to the right of the period
- optional commas
- optional dollar sign($)
Match examples:
- "$3,333,333,333"
- "$333333"
- "$3,333.33"
Non-match examples:
- "3,33"
- "3333,333,333"
Regular expression: ^(\$)?((\d+)|(\d{1,3})(\,\d{3})*)(\.\d{2,})?$
Validates *usable* US telephone numbers. Numbers cannot beginning with zero, one, (any number)11, or 555. It will allow either a hyphen, space or period as a separator.
Match examples:
- "222-2222"
- "295-5000"
- "798-7534"
Non-match examples:
- "555-1234"
- "411-5555"
Regular expression: ^(?!\d[1]{2}|[5]{3})([2-9]\d{2})([. -]*)\d{4}$
US Phone Number: This regular expression for US phone numbers conforms to NANP A-digit and D-digit requirments (ANN-DNN-NNNN). Area Codes 001-199 are not permitted; Central Office Codes 001-199 are not permitted. Format validation accepts 10-digits without delimiters, optional parens on area code, and optional spaces or dashes between area code, central office code and station code. Acceptable formats include 2225551212, 222 555 1212, 222-555-1212, (222) 555 1212, (222) 555-1212, etc.
Match examples:
- "5305551212"
- "(530) 555-1212"
- "530-555-1212"
Non-match examples:
- "0010011212"
- "1991991212"
Regular expression: ^(?:\([2-9]\d{2}\)\ ?|[2-9]\d{2}(?:\-?|\ ?))[2-9]\d{2}[- ]?\d{4}$
Validates a date expression (or empty value) in CCYYMMDD format, checking a leap year from 00000101 A.D. to 99991231
Match examples:
- "20041231"
- "20040229"
- "20040612"
Non-match examples:
- "20043112"
- "2003/04/02"
Regular expression: ^(((\d{4}((0[13578]|1[02])(0[1-9]|[12]\d|3[01])|(0[13456789]|1[012])(0[1-9]|[12]\d|30)|02(0[1-9]|1\d|2[0-8])))|((\d{2}[02468][048]|\d{2}[13579][26]))0229)){0,8}$