s2e-lab/RegexEval huggingface dataset:
Matches valid 3 or 6 character hex codes used for HTML or CSS.
Match examples:
- "fff"
- "#990000"
- "#cc3366"
Non-match examples:
- "#5555"
- "#ZJK000"
Regular expression: ^\#?[A-Fa-f0-9]{3}([A-Fa-f0-9]{3})?$
Matches password of 6 symbols. Must contain at least one non-capital letter and at least digit digit
Match examples:
- "abc123"
- "()()a1"
- "_ABCDa1"
Non-match examples:
- "abcdef"
- "ab_12"
Regular expression: ^(?=.{6,})(?=.*[0-9].*)(?=.*[a-z].*).*$
Matches hours 0-12:minutes 0-59:seconds 0-59 AM|PM
Match examples:
- "0:00:00 AM"
- "10:50:55 PM"
- "11:59:59 PM"
Non-match examples:
- "1:00 AM"
- "5:3:00 PM"
Regular expression: ((\d{0}[0-9]|\d{0}[1]\d{0}[0-2])(\:)\d{0}[0-5]\d{0}[0-9](\:)\d{0}[0-5]\d{0}[0-9]\s(AM|PM))
Matches currency with a decimal point. Does not require any places of decimal point
Match examples:
- "13"
- "13."
- "13.1"
Non-match examples:
- "01"
- ".1"
Regular expression: ^(([1-9]{1}[0-9]{0,5}([.]{1}[0-9]{0,2})?)|(([0]{1}))([.]{1}[0-9]{0,2})?)$
This will test to see if a date is formatted in the military style of 'dd MMM yy'
Match examples:
- "12 DEC 08"
- "03 jan 91"
- "30 Mar 82"
Non-match examples:
- "41 DEC 08"
- "03 jan 1991"
Regular expression: ^[0-3]{1}[0-9]{1}[ ]{1}(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec){1}[ ]{1}[0-9]{2}$
Validates that a string represents a javascript number (as defined by ECMAScript 3 Specs): integer (base-10) or floating
point including in the exponential notation. Doesn't match the empty string.
Match examples:
- "23"
- "-17.e23"
- "+.199E-19"
Non-match examples:
- "+.e2"
- "23.17.5"
Regular expression: ^[-+]?(?:\d+\.?|\.\d)\d*(?:[Ee][-+]?\d+)?$
Matches all kind of URIs: mailto's, http(s), (s)ftp(s), ..., or just www addresses without protocol prefix.
Match examples:
- "ftp://domain.com"
- "sftp://subdomain.domain.com"
- "mailto:yourname@rommel.com"
Non-match examples:
- "gopher://anything.com"
- "subdomain.domain.com"
Regular expression: (((s*)(ftp)(s*)|(http)(s*)|mailto|news|file|webcal):(\S*))|((www.)(\S*))
Complete date-time format according to the ISO 8601 standard.
Match examples:
- "2004-10-31T22:06:00+12:00"
- "2006-04-31T12:31:39.6230000+05:45"
- "2009-01-08T20:25:26-03:00"
Non-match examples:
- "2009-01-09T12:23:34"
- "2009-01-09 17:45:22"
Regular expression: \d{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(?:.\d{7})?[+|-](0[0-9]|1[0-2]):(00|15|30|45)
Matches against dumps of Cisco MAC address tables on newer versions of Cisco IOS.
Match examples:
- "001e.1324.683f"
- "1234.abcd.1234"
- "ffff.ffff.ffff"
Non-match examples:
- "001E.1324.683f"
- "001234.abcd.abcd"
Regular expression: ^([0-9a-f]{4}\.[0-9a-f]{4}\.[0-9a-f]{4})$
An expression to validate a search string which accepts a wildcard(asterik) at most once anywhere in the string.
Match examples:
- "search*"
- "*search"
- "se*rch"
Non-match examples:
- "search**"
- "**search"
Regular expression: ^[^\*]{0,}[\*]{0,1}[^\*]{0,}$
To validate a number of 10 digits before the decimal point and atmost 2 digits after it
Match examples:
- "12314"
- "12314.2"
- "12314.32"
Non-match examples:
- "12314.212"
- "12123.222"
Regular expression: (?!^0*$)(?!^0*\.0*$)^\d{1,10}(\.\d{1,2})?$
Matches numbers and they can have values after a decimal point
Match examples:
- "123.23"
- "123.1234"
- "1234"
Non-match examples:
- "123a.12"
- "123.34d"
Regular expression: ^\d*[0-9](|.\d*[0-9]|)*$
Regular expression for validating that input string should not have special characters(e.g. $,#,@ etc.]
Match examples:
- "Employee"
- "Employee_Test"
- "Employee_Dept"
Non-match examples:
- "Employee.Test"
- "Employee$Test"
Regular expression: ^[a-zA-Z0-9]+(([_][a-zA-Z0-9])?[a-zA-Z0-9]*)*$
checks to see if a URL has http:// in it, and if it has either www or a subdomain before the domain and tld. Without (http\://) it only does the latter check.
Match examples:
- "http://www.pass.com http://sub.pass.com http://www.sub.pass.com http://sub.sub.pass.com http://www.sub.sub.pass.com"
- "http://NL4KW9dJFzU4AlKY9rHZXNDnuX5v9mu0HEzDdkN9-cVCTS5v-qlrCKlMOw72dvN22tFoQgPY.pH.So%sh,%?Pti6eF~$~O~HH#+6C0Xn.JbZ\Y$\\l8nR,61gbhHAGNCTP.L0h5gqKMoqPEv%_75,%"
- "http://3UWfs9mB1D3Ciwg1cLlUmjmQ4DELt1gXBkkc8w4GdJ2P0txeJg-Nu022UVUAFZeosrJ74LoqyHG5y8cgaJHyk98XYAI.KHaOWshJITNckgemqvfGMci7llelRMEkDDfC1jWjzVGdd2yWdDyuI3Xk9Z-2MpgbssxQkttyQSzXLtVy3Ug-NnAWEAXX0iQB3v.2sPsignuFg524sJWDYFhpP90UsgPiN31AJOMDrvjuk7gCHqzfgiA6a5QxTDGlbPf3jkd9uGbUTCVoceWEP2ZzeDShsKE9.gS.T%Qvd#Cvu=/0gL0QkW_PBB~gEoV\0K,de$do9q%Cf#2T-c=XS-~wsz;y,i%ze4vw81?3%1FoO8E$"
Non-match examples:
- "fail.com"
- "www.fail.com"
Regular expression: ^(http\://){1}(((www\.){1}([a-zA-Z0-9\-]*\.){1,}){1}|([a-zA-Z0-9\-]*\.){1,10}){1}([a-zA-Z]{2,6}\.){1}([a-zA-Z0-9\-\._\?\,\'/\\\+&amp;%\$#\=~])*
Match examples:
- "Content-Type: multipart/mixed; boundary="---myboundary""
- "Content-Type: multipart/mixed;boundary=---myBoundarysi3cds"
- "Content-Type: text/plain;"
Non-match examples:
- "Content Type: multipart/mixed"
- "Content-Type: text/plain"
Regular expression: ^Content-Type:\s*(\w+)\s*/?\s*(\w*)?\s*;\s*((\w+)?\s*=\s*((".+")|(\S+)))?
erfvds
Match examples:
- "0229"
- "0331"
- "0630"
Non-match examples:
- "0230"
- "0431"
Regular expression: ^((0[123456789]|1[0-2])(0[1-3]|1[0-9]|2[0-9]))|((0[13456789]|1[0-2])(30))|((0[13578]|1[02])(31))$
Matches single line or multi-line comments.
Match examples:
- "// Comment here"
- "/// Comment here"
- "/* Cmment Here */"
Non-match examples:
- "/ * Comment Here */"
- "/* Comment here * /"
Regular expression: //.*|/\*[\s\S]*?\*/
Matches BFPO (can have no spacing)
Match examples:
- "BFPO 2"
- "BFPO 2222"
- "BFPO C/O 121"
Non-match examples:
- "bf po 1212, BFPO 22222"
- "BF"
Regular expression: ^(b|B)(f|F)(p|P)(o|O)(\s*||\s*C(/|)O\s*)[0-9]{1,4}
Regex to validate strong passwords with a length of at least 7 and contains one non-alphanumeric character.
Match examples:
- "12345!r@r"
- "#dfgjaydh%"
- "aA1!@#$%"
Non-match examples:
- "12345rfg"
- "hsjahdgs"
Regular expression: (?=^[!@#$%\^&*()_\-+=\[{\]};:<>|\./?a-zA-Z\d]{7,}$)(?=([!@#$%\^&*()_\-+=\[{\]};:<>|\./?a-zA-Z\d]*\W+){1,})[!@#$%\^&*()_\-+=\[{\]};:<>|\./?a-zA-Z\d]*$
Matches a string if it is a valid time in the format of HH:MM
Match examples:
- "02:04"
- "16:56"
- "23:59"
Non-match examples:
- "02:00 PM"
- "PM2:00"
Regular expression: ^(([0-1]?[0-9])|([2][0-3])):([0-5][0-9])$
Validates Numeric values with commas and limited decimal places. Can change the value d{1,2} to limit decimal places from 1 to n
Match examples:
- "1,000"
- "1,200.45"
- "4,567,567.45"
Non-match examples:
- "$1,000"
- "1,200.45343"
Regular expression: ^(\d)?(\d|,)*\.?\d{1,2}$
Matches phone number with country prefix +2 or +22 (one or two digits), then City code in parenthesis, like (444), then phone number 6 to 8 digits and optional extension '#XXX' up to 10 digits
Match examples:
- "+7(834)4328933#890"
- "+72(834)43289323#8902892"
- "+33(834)328932"
Non-match examples:
- "+7(834)4328933#"
- "+7(834)4328#89908"
Regular expression: ^[+]\d{1,2}\(\d{2,3}\)\d{6,8}(\#\d{1,10})?$
Matches phone numbers with any international country code with an optional extension number.
Match examples:
- "+17034567890"
- "+17034567890x1234"
- "+912024553455"
Non-match examples:
- "x1234"
- "+1"
Regular expression: ^(\+[0-9]{2,}[0-9]{4,}[0-9]*)(x?[0-9]{1,})?$
Matches if the string is in hh:mm am/pm format. The hour and minute values need to have left padding 0's if they are single digits.
Match examples:
- "03:45 am"
- "10:24 PM"
- "01:03 pm"
Non-match examples:
- "8:15 am"
- "16:10"
Regular expression: ^([0][1-9]|[1][0-2]):[0-5][0-9] {1}(AM|PM|am|pm)$
Matches texts within a string that is enclosed within parenthesis ( )
Match examples:
- "Test (test 1)"
- "(test)"
- "Test (test 1) Test (test 2)"
Non-match examples:
- "Test"
- "AM"
Regular expression: [\(]{1,}[^)]*[)]{1,}
Matches all valid Linux absolute paths (files or folders). Will not work for relative paths that do not begin with a /, Also will only match files that have extensions consisting of 2, 3, or 4 characters. Fails with _ . or - in the path.
Match examples:
- "/mnt/share/"
- "/home/.BASH"
- "/mnt/share/pic.jpeg"
Non-match examples:
- "mnt/share"
- "//mnt///share//"
Regular expression: ^/{1}(((/{1}\.{1})?[a-zA-Z0-9 ]+/?)+(\.{1}[a-zA-Z0-9]{2,4})?)$
Matches Personal Identification Number (PIN) from 1900 to1953, which have a suffix with three digits, and a PIN beyond 1954 have four digits in suffix
Match examples:
- "760612/5689"
- "826020/5568"
- "500101/256"
Non-match examples:
- "680645/256"
- "707212/1258"
Regular expression: ^([0-9]{2})(01|02|03|04|05|06|07|08|09|10|11|12|51|52|53|54|55|56|57|58|59|60|61|62)(([0]{1}[1-9]{1})|([1-2]{1}[0-9]{1})|([3]{1}[0-1]{1}))/([0-9]{3,4})$
Matches dates with the following constrictions

SUPPORTED constructions:
[*] - all five commands;
[number] - minutes 0...59, hours 0...23, day in month 1...31, months 1...12, day in week 0...7 (0 & 7 is sun);
[*/nubmer] - see construction [number];
[word] - only months (4th command) and days in week (5th command), warning this regexp is case sensitive (lower letters).
NON SUPPORTED constructions:
[number-number] and
[number,number].
Match examples:
- "*/15 */12 30 feb 7"
- "10 * * * */2"
- "* * * * *"
Non-match examples:
- "62 * * */2 *"
- "* * * 0 *"
Regular expression: ^(((([\*]{1}){1})|((\*\/){0,1}(([0-9]{1}){1}|(([1-5]{1}){1}([0-9]{1}){1}){1}))) ((([\*]{1}){1})|((\*\/){0,1}(([0-9]{1}){1}|(([1]{1}){1}([0-9]{1}){1}){1}|([2]{1}){1}([0-3]{1}){1}))) ((([\*]{1}){1})|((\*\/){0,1}(([1-9]{1}){1}|(([1-2]{1}){1}([0-9]{1}){1}){1}|([3]{1}){1}([0-1]{1}){1}))) ((([\*]{1}){1})|((\*\/){0,1}(([1-9]{1}){1}|(([1-2]{1}){1}([0-9]{1}){1}){1}|([3]{1}){1}([0-1]{1}){1}))|(jan|feb|mar|apr|may|jun|jul|aug|sep|okt|nov|dec)) ((([\*]{1}){1})|((\*\/){0,1}(([0-7]{1}){1}))|(sun|mon|tue|wed|thu|fri|sat)))$
Matches strings with capital letters and numbers
Match examples:
- "BB123AB"
- "KE 999BB"
- "BA 362SO"
Non-match examples:
- "QT 123AB"
- "BB 1234AA"
Regular expression: ^(B(A|B|C|J|L|N|R|S|Y)|CA|D(K|S|T)|G(A|L)|H(C|E)|IL|K(A|I|E|K|M|N|S)|L(E|C|M|V)|M(A|I|L|T|Y)|N(I|O|M|R|Z)|P(B|D|E|O|K|N|P|T|U|V)|R(A|K|S|V)|S(A|B|C|E|I|K|L|O|N|P|V)|T(A|C|N|O|R|S|T|V)|V(K|T)|Z(A|C|H|I|M|V))([ ]{0,1})([0-9]{3})([A-Z]{2})$
Matches letters (a - h) and number s(1 - 8). Case insensitive.
Match examples:
- "A1"
- "a8"
- "b3"
Non-match examples:
- "i5"
- "F9"
Regular expression: ^([a-hA-H]{1}[1-8]{1})$
Matches communication ports in PC between 1 - 65536.
Match examples:
- "1"
- "80"
- "65536"
Non-match examples:
- "0"
- "0999"
Regular expression: ^([1-9]{1}|[1-9]{1}[0-9]{1,3}|[1-5]{1}[0-9]{4}|6[0-4]{1}[0-9]{3}|65[0-4]{1}[0-9]{2}|655[0-2]{1}[0-9]{1}|6553[0-6]{1})$
Matches money with € or EUR or EURO (all case sensitive).
Match examples:
- "0,00 €"
- "1 234 567,89 EUR"
- "1,-- EURO"
Non-match examples:
- "00,00 €"
- "1234567,89 EUR"
Regular expression: ^(0|(([1-9]{1}|[1-9]{1}[0-9]{1}|[1-9]{1}[0-9]{2}){1}(\ [0-9]{3}){0,})),(([0-9]{2})|\-\-)([\ ]{1})(€|EUR|EURO){1}$
Matches all dates (mm/dd/yyyy or mm/dd/yy) greater than or equal to the SQL minimum date of 01/01/1753 and less than or equal to 12/31/9999. Does not check for leap years.
Match examples:
- "01/01/1753"
- "9/2/09"
- "12/02/1980"
Non-match examples:
- "1/1/1"
- "13/1/01"
Regular expression: ^(0?[1-9]|1[0-2])\/(0?[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|[1-9][0-9]|175[3-9]|17[6-9][0-9]|1[8-9][0-9]{2}|[2-9][0-9]{3})$
validate both IP V4 and IP V6
Match examples:
- "192.168.0.1"
- "000.000.000.000.000.000"
- "999.999.999.999.999.999"
Non-match examples:
- "1.1.1.1.1"
- "1.1"
Regular expression: ^\d{1,3}((\.\d{1,3}){3}|(\.\d{1,3}){5})$
Matches net mask address
Match examples:
- "255.255.192.0"
- "240.0.0.0"
- "255.255.255.0"
Non-match examples:
- "255.0.192.0"
- "240.128.0.0"
Regular expression: ^(((0|128|192|224|240|248|252|254).0.0.0)|(255.(0|128|192|224|240|248|252|254).0.0)|(255.255.(0|128|192|224|240|248|252|254).0)|(255.255.255.(0|128|192|224|240|248|252|254)))$
Matches ip address/netmask couple
Match examples:
- "192.168.0.5/24"
- "255.255.0.0/32"
- "162.226.103.215/4"
Non-match examples:
- "192.256.0.5/24"
- "255.255.0.0/40"
Regular expression: ^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})(/([0-9]|[0-2][0-9]|3[0-2]))$
Matches dates with any format, such as mm/dd/yyyy, mm/dd/yy, mmddyy, mmddyyyy with the ability to use "/" and "." and "-" or nothing as separation characters.
Match examples:
- "032103"
- "02/29/2008"
- "10.31.1990"
Non-match examples:
- "2-29-00"
- "11.31.1992"
Regular expression: \b(((0[13578]|1[02])[\/\.-]?(0[1-9]|[12]\d|3[01])[\/\.-]?(19|20)?(\d{2}))|(0[13456789]|1[012])[\/\.-]?(0[1-9]|[12]\d|30)[\/\.-]?(19|20)?(\d{2}))|(02[\/\.-]?(0[1-9]|1\d|2[0-8])[\/\.-]?(19|20)?(\d{2}))|(02[\/\.-]?29[\/\.-]?(19|20)?((0[48]|[2468][048]|[13579][26])|(00)))\b
Will match a date accepted by MySQL datetime type.
Years with 2 or 4 digits from any range.
Months with 2 digits from 00 to 12.
days with 2 digits from 00 to 31.
Hours with 2 digits from 00-23
Minutes with 2 digits from 00 to 59.
Seconds with 2 digits from 00 to 59.
Match examples:
- "00-00-00 00:00:00"
- "0000-00-00 00:00:00"
- "09-05-22 08:16:00"
Non-match examples:
- "2009-13:01 00:00:00"
- "2009-12-32 00:00:00"
Regular expression: (\d{2}|\d{4})(?:\-)?([0]{1}\d{1}|[1]{1}[0-2]{1})(?:\-)?([0-2]{1}\d{1}|[3]{1}[0-1]{1})(?:\s)?([0-1]{1}\d{1}|[2]{1}[0-3]{1})(?::)?([0-5]{1}\d{1})(?::)?([0-5]{1}\d{1})
Will match any number from range -128 to 127 to represent a byte type.
Match examples:
- "-128"
- "127"
- "0"
Non-match examples:
- "-129"
- "128"
Regular expression: ^(0|[-]{1}([1-9]{1}[0-9]{0,1}|[1]{1}([0-1]{1}[0-9]{1}|[2]{1}[0-8]{1}))|(\+)?([1-9]{1}[0-9]{0,1}|[1]{1}([0-1]{1}[0-9]{1}|[2]{1}[0-7]{1})))$
Matches a short number from range -32768 to 32767.
Match examples:
- "-32768"
- "-10"
- "0"
Non-match examples:
- "+0"
- "-0"
Regular expression: ^(0|[-]{1}([1-9]{1}[0-9]{0,3}|[1-2]{1}[0-9]{1,4}|[3]{1}([0-1]{1}[0-9]{3}|[2]{1}([0-6]{1}[0-9]{2}|[7]{1}([0-5]{1}[0-9]{1}|([6]{1}[0-8]{1})))))|(\+)?([1-9]{1}[0-9]{0,3}|[1-2]{1}[0-9]{1,4}|[3]{1}([0-1]{1}[0-9]{3}|[2]{1}([0-6]{1}[0-9]{2}|[7]{1}([0-5]{1}[0-9]{1}|([6]{1}[0-7]{1}))))))$
Matches an unsigned short number from range 0 to 65535
Match examples:
- "0"
- "100"
- "65535"
Non-match examples:
- "-0"
- "+0"
Regular expression: ^(0|(\+)?([1-9]{1}[0-9]{0,3})|([1-5]{1}[0-9]{1,4}|[6]{1}([0-4]{1}[0-9]{3}|[5]{1}([0-4]{1}[0-9]{2}|[5]{1}([0-2]{1}[0-9]{1}|[3]{1}[0-5]{1})))))$
Will match any unsigned integer from range 0 to 4294967295
Match examples:
- "0"
- "1000"
- "4294967295"
Non-match examples:
- "-100"
- "-0"
Regular expression: ^(0|(\+)?[1-9]{1}[0-9]{0,8}|(\+)?[1-3]{1}[0-9]{1,9}|(\+)?[4]{1}([0-1]{1}[0-9]{8}|[2]{1}([0-8]{1}[0-9]{7}|[9]{1}([0-3]{1}[0-9]{6}|[4]{1}([0-8]{1}[0-9]{5}|[9]{1}([0-5]{1}[0-9]{4}|[6]{1}([0-6]{1}[0-9]{3}|[7]{1}([0-1]{1}[0-9]{2}|[2]{1}([0-8]{1}[0-9]{1}|[9]{1}[0-5]{1})))))))))$
Validate hours and minutes with seconds in format HH:MM:SS
Match examples:
- "09:05"
- "10:00"
- "1:15"
Non-match examples:
- "9:5"
- "09:1"
Regular expression: ^([0-1][0-9]|[2][0-3]|[0-9]):([0-5][0-9])(?::([0-5][0-9]))?$
Validate a date format: d/m/Y.
Match examples:
- "1/05/1990"
- "01/1/2006"
- "01/01/2008"
Non-match examples:
- "01/01/90"
- "32/02/2009"
Regular expression: ^([0-2]\d|3[0-1]|[1-9])\/(0\d|1[0-2]|[1-9])\/(\d{4})$
Matches start time transitioned to time stoped.
Match examples:
- "00:12:35,126 --> 00:12:35,526"
- "19:17:56,770 --> 22:03:42,473!0zDasW9$Xf?,b0l A~$*_VX0|9i]vN91jj3|Q:TRw720#Ag9G&&ru:HFNx96"
- "21:19:00,760 --> 23:02:33,62445t/,k%po2Kdf6$2=}Ww,bG98Fv~nPV0@z>@R\-6~AJDwRP&s<WC][fwv<p(|5uN[#^`r!)>;to^=o4"
Non-match examples:
- "00:59:35,126 --> 00:60:20,500"
- "00:16:20,200 --> 00:16:20,30"
Regular expression: ^([0-1][0-9]|2[0-3]){1}:([0-5][0-9]){1}:([0-5][0-9]){1},([0-9][0-9][0-9]){1} --> ([0-1][0-9]|2[0-3]){1}:([0-5][0-9]){1}:([0-5][0-9]){1},([0-9][0-9][0-9]){1}(.*)$
Matches numbers in two sets of curly brackets.
Match examples:
- "{100}{150}subtitle"
- "{1234}{1234}subtitle"
- "{1}{2}subtitle"
Non-match examples:
- "{0100}{1000}subtitle"
- "{}{100}subtitle"
Regular expression: ^\{([1-9]{1}|[1-9]{1}[0-9]{1,}){1}\}\{([1-9]{1}|[1-9]{1}[0-9]{1,}){1}\}(.*)$
Matches strings of any character between double quotes
Match examples:
- ""Ram""
- ""\9=\z\C\?""
- ""Ram Shyam""
Non-match examples:
- "ram"
- "shyam"
Regular expression: "([^\\"]|\\.)*"
This expression will allow whole dollar amounts (along with $ and ,) which are 20 digit wide. So the maximum amount will be $99,999,999,999,999,999,999. Note: This regular expression allows skipped commas, but will not allow multiple or commas at the wrong location. This can be used for all languages that have comma before the 3rd, 6th, 9th... digit.
Match examples:
- "$99,999,999,999,999,999,999"
- "$56,987"
- "56,123456,456"
Non-match examples:
- "$77,8,888"
- "asadf"
Regular expression: ^(\$?)((\d{1,20})|(\d{1,2}((,?\d{3}){0,6}))|(\d{3}((,?\d{3}){0,5})))$
Matches single- or multi-digit signed Integer.
Match examples:
- "12"
- "-2"
- "+3213"
Non-match examples:
- "abc"
- "@41"
Regular expression: ^[+-]?[0-9]+$
Matches any integer or decimal number with either dot (.) or comma (,) as decimal- and thousands-separator. Also accepts Scientific notation.
Match examples:
- "-4,233.2832e12"
- "+232"
- "-0.12e-5"
Non-match examples:
- "abc"
- "@41"
Regular expression: ^[+-]?\d*(([,.]\d{3})+)?([,.]\d+)?([eE][+-]?\d+)?$
This matches any valid IPV4 IP Address. It includes 0-255 range checks since none of the IP components may exceed 255.
Match examples:
- "97.67.44.20"
- "199.154.37.214"
- "127.0.0.1"
Non-match examples:
- "63.125.94.287"
- "140.370.a.187"
Regular expression: ^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})){3}$
Matches any valid 3 or 6 digit hexadecimal colour value.
Match examples:
- "#ff9900"
- "#abc"
- "#92fea5"
Non-match examples:
- "ab"
- "#92a2"
Regular expression: ^#?(([a-fA-F0-9]{3}){1,2})$
Matches string between chars " " as in source code
Match examples:
- """"
- ""\n""
- ""test""
Non-match examples:
- "test"
- ""test"
Regular expression: ("((\\.)|[^\\"])*")
Matches string between chars ' ' as in source code
Match examples:
- "''"
- "'\n'"
- "'test'"
Non-match examples:
- "test"
- "'test"
Regular expression: ('((\\.)|[^\\'])*')
Matches common Degree, Minute, and Second coordinate values. [N|S|E|W] to [N|S] for latitude or [E|W] for longitude.
Match examples:
- "12:12:12.223546"N"
- "12:12:12.2246N"
- "15:17:6"S"
Non-match examples:
- "12.2225"
- "15.25.257S"
Regular expression: [0-9]{1,2}[:|°][0-9]{1,2}[:|'](?:\b[0-9]+(?:\.[0-9]*)?|\.[0-9]+\b)"?[N|S|E|W]
Matches UK Bank account numbers that have 8 digits
Match examples:
- "08464524"
- "45832484"
- "24899544"
Non-match examples:
- "1234567"
- "1 5 2226 44"
Regular expression: ^(\d){8}$
Matches UK Bank Account numbers with 7 or 8 numbers
Match examples:
- "1234567"
- "12345678"
- "0746425"
Non-match examples:
- "123456"
- "123 4567"
Regular expression: ^(\d){7,8}$
Matches strings with no white space
Match examples:
- "nowhitespace"
- "onewordonly"
- "anotherexample"
Non-match examples:
- "two words"
- "three words here"
Regular expression: ^[^\s]+$
validates a date-time field in European dd/mm/yyyy hh:mm format
Match examples:
- "29/02/2008 15:30"
- "18/09/6210 16:51"
- "29/02/0800 22:04"
Non-match examples:
- "29/02/2009 25:62"
- "date"
Regular expression: (((((0[1-9]|[12][0-9]|3[01])/(0[13578]|1[02]))|((0[1-9]|[12][0-9]|30)/(0[469]|11))|((0[1-9]|[1][0-9]|2[0-8]))/02)/([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3}) ((([0-1][0-9])|([2][0-3]))[:][0-5][0-9]$))|(29/02/(([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00)) ((([0-1][0-9])|([2][0-3]))[:][0-5][0-9]$)))
This pattern matches strings where no more than two equal characters may come in succession.
Match examples:
- "Abba"
- "p4ssw0rd"
- "Whatever"
Non-match examples:
- "Abbba"
- "p4sssw0rd"
Regular expression: ^((.)(?!\2{2,}))+$
validate usernames with dot or underscoures doesn't allow spaces and accept characters between 5 and 15 no other characters
Match examples:
- "Ahmad.egypt"
- "ahmad_egypt"
- "5YyFbx4uOO"
Non-match examples:
- "Ahmad@egypt"
- "Ahmad*egypt"
Regular expression: ^[\w_.]{5,12}$
validate strings without spaces and accept from 5 to 12 characters per string
Match examples:
- "ahmed"
- "Muhammad"
- "Hassan"
Non-match examples:
- "a hmed"
- "Hass an"
Regular expression: ^([^\s]){5,12}$
Matches India phone numbers, accepted with optional +91 national code and 0 for land and mobile number prefix. Allows optional - after national code
Match examples:
- "+91-9764544544"
- "09764544544"
- "01087656444"
Non-match examples:
- "+91-01087656444"
- "+91-09764544544"
Regular expression: ^((\+)?(\d{2}[-])?(\d{10}){1})?(\d{11}){0,1}?$
Validate time length (5d16h45m, etc). Does not allow more than 365 days, 23 hrs or 59 min.
Match examples:
- "365d23h59m"
- "90d18h45m"
- "05d19h45m"
Non-match examples:
- "366d23h45m"
- "90d24h5m"
Regular expression: ^(([0-9]{1})|([0-9]{1}[0-9]{1})|([1-3]{1}[0-6]{1}[0-5]{1}))d(([0-9]{1})|(1[0-9]{1})|([1-2]{1}[0-3]{1}))h(([0-9]{1})|([1-5]{1}[0-9]{1}))m$
In month/day/year format. Matches valid months (1-12) and valid days (1-31) and a valid 4 digit year (from 1000-2999). $1 = month, $2 = day, $3 = year. Doesn't check to make sure that months have a valid number of days (no Feb 30th checks, etc).
Match examples:
- "1/12/2003"
- "04/8/1995"
- "12/31/2035"
Non-match examples:
- "13/04/2000"
- "4/32/1593"
Regular expression: ^(0?[1-9]|1[012])/([012][0-9]|[1-9]|3[01])/([12][0-9]{3})$
This regular expression matches the format MM/DD/YYYY. Month and Day can have an optional leading 0. Months are from 01-12, days are from 01-31, and years are from 1000-2999.
Match examples:
- "1/1/1999"
- "01/01/2001"
- "12/31/1900"
Non-match examples:
- "00/12/0999"
- "13/1/2000"
Regular expression: ^(([0]?[1-9])|(1[0-2]))\/(([0]?[1-9])|([1,2]\d{1})|([3][0,1]))\/[12]\d{3}$
validates jpg/jpeg picture extension
Match examples:
- "marko.jpg"
- "marko.pic.jpeg"
- "B`/@}LltmV56t?)#QW*cY'k9r{l,6)0~@(k!V~y5'{*k@;Ow8~jvb<Y:r+QqCy5%uwu|1*FV-4/pl+#RI.jpg"
Non-match examples:
- "marko.exe"
- "pic"
Regular expression: ^(.)+\.(jpg|jpeg|JPG|JPEG)$
Matches special characters
Match examples:
- "#This Is $$## Where Your Main String Goes"
- ">"
- ")"
Non-match examples:
- "This is a test"
- "letter"
Regular expression: [^A-Za-z0-9 ]
This RE will match all numbers between (including) 0001 and 9999. Four places of digits are mandatory in this expression.
Match examples:
- "0001"
- "0064"
- "0948"
Non-match examples:
- "1"
- "64"
Regular expression: ^([1-9]\d{3}|0[1-9]\d{2}|00[1-9]\d{1}|000[1-9]{1})$
RE to match numbers with value greater than 0.
Match examples:
- "0001"
- "120064"
- "1000000"
Non-match examples:
- "0"
- "000000000"
Regular expression: ^([\d]*[1-9]+[\d]*)$
Matches over 18 different combinations for UK phone numbers
Match examples:
- "0121 111 1111"
- "+44 (0)21 444 4444"
- "07941 111 111"
Non-match examples:
- "0121_111_3333"
- "324RE"
Regular expression: ((\+44\s?\(0\)\s?\d{2,4})|(\+44\s?(01|02|03|07|08)\d{2,3})|(\+44\s?(1|2|3|7|8)\d{2,3})|(\(\+44\)\s?\d{3,4})|(\(\d{5}\))|((01|02|03|07|08)\d{2,3})|(\d{5}))(\s|-|.)(((\d{3,4})(\s|-)(\d{3,4}))|((\d{6,7})))
Validates if the Graduate Management Admission (GMAT) score is in the correct range and format
Match examples:
- "0"
- "190"
- "800"
Non-match examples:
- "050"
- "700.5"
Regular expression: ^([0-9]|[1-9]\d|[1-7]\d{2}|800)$
Matches Singapore phone numbers. The first digit must start with a "6", and the rest is made up of 7 digits, for a total of 8 digits.
Match examples:
- "61234567"
- "63829324"
- "67654321"
Non-match examples:
- "6123-4567"
- "6-CALL-CPY"
Regular expression: ^[6]\d{7}$
Match the numbers 100 to 199
Match examples:
- "100"
- "101"
- "112"
Non-match examples:
- "200"
- "-3"
Regular expression: (\b(10|11|12|13|14|15|16|17|18|19)[0-9]\b)
allows 1 to 99 in .5 increments which I originally developed for a forum post
Match examples:
- "1.5"
- "99.5"
- "35.5"
Non-match examples:
- ".5"
- "100"
Regular expression: ^[1-9]{1,2}(.5)?$