RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Browse Expressions by Category

91 regular expressions found in this category!

Expressions in category: Strings

Change page:   |    Displaying page 1 of 5 pages; Items 1 to 20
Title Test Details Pattern Title
Expression
^([A-Z|a-z|&]{3}\d{2}((0[1-9]|1[012])(0[1-9]|1\d|2[0-8])|(0[13456789]|1[012])(29|30)|(0[13578]|1[02])31)|([02468][048]|[13579][26])0229)(\w{2})([A|a|0-9]{1})$|^([A-Z|a-z]{4}\d{2}((0[1-9]|1[012])(0[1-9]|1\d|2[0-8])|(0[13456789]|1[012])(29|30)|(0[13578]|1[02])31)|([02468][048]|[13579][26])0229)((\w{2})([A|a|0-9]{1})){0,3}$
Description
Registro Federal de Contribuyentes (RFC) , used in Mexico as a unique set of caracters for a person or corporation registration . Registro Federal de Contribuyentes utilizado en Mexico para el registro en hacienda.
Matches
ABCD790419 | ABC790419aa1 | ABCD790419AB1
Non-Matches
AB790419 | A12790419 | ABC791332
Author Rating: The rating for this expression. Leo Hinojosa
Title Test Details Pattern Title
Expression
(?<FirstName>[A-Z]\.?\w*\-?[A-Z]?\w*)\s?(?<MiddleName>[A-Z]\w*|[A-Z]?\.?)\s?(?<LastName>[A-Z]\w*\-?[A-Z]?\w*)(?:,\s|)(?<Suffix>Jr\.|Sr\.|IV|III|II|)
Description
A regex that attempts to accurately parse the elements from a proper name where the format is in &lt;&lt;First, Last&gt;&gt; order or some permutation of that order. Critiques and suggestions for improvement are welcome.
Matches
David F Walker | J. S. Smith, Jr. | Catherine Zeta-Jones
Non-Matches
oscar peterson
Author Rating: The rating for this expression. David Walker
Title Test Details Pattern Title
Expression
^(?=[^\d_].*?\d)\w(\w|[!@#$%]){7,20}
Description
This regex can be used to restrict passwords to a length of 8 to 20 aplhanumeric characters and select special characters. The password also can not start with a digit, underscore or special character and must contain at least one digit.
Matches
password1 | pa$$word2 | pa!@#$%3
Non-Matches
password | 1stpassword | $password#
Author Rating: The rating for this expression. Michael Ash
Title Test Details Pattern Title
Expression
^(([a-h,A-H,j-n,J-N,p-z,P-Z,0-9]{9})([a-h,A-H,j-n,J-N,p,P,r-t,R-T,v-z,V-Z,0-9])([a-h,A-H,j-n,J-N,p-z,P-Z,0-9])(\d{6}))$
Description
Tests Vehicle Identification Numbers (VINs). This works for a Mitsubishi cars in the UK - but I have been unable to determine whether the format is for UK vehicles or applies only to this make. The requirements are that the first 9 characters and the 11th character are alpha-numeric excluding i, I, o or O. The 10th character is the chassis year, and is alpha-numeric excluding i, I, o, O, q, Q, u, and U. The final 6 characters are numeric. The string is 17 characters in length. Any refinements would be greatly appreciated!
Matches
abcDEFghp3t123456 | A1C3E5G6Y98123456 | A1C3E5G6FFF123456
Non-Matches
AIC3E5G6FFF123456 | A8C3E5G6FQF123456 | A8C3E5G6F9F12345H
Author Rating: The rating for this expression. Edward Collier
Title Test Details Pattern Title
Expression
^([1-zA-Z0-1@.\s]{1,255})$
Description
A general string validation to insure no malicious code is being passed through user input. General enough too allow email address, names, address, passwords, so on. Disallows ‘,\*&amp;$&lt;&gt; or other characters that could cause issues.
Matches
email@email.com | My Name | asdf12df
Non-Matches
‘,\*&amp;$&lt;&gt; | 1001' string
Author Rating: The rating for this expression. Paul Miller
Title Test Details Pattern Title
Expression
^[a-zA-Z0-9]+$
Description
it will check for alphanumeric (Alpha Numeric) values.
Matches
adad1213 | 1231dfadfa | dfad123dfasdfs
Non-Matches
dfa@#12313 | *(*sdfasdfadfd | $fffsdg121ddd#$f1q
Author Rating: The rating for this expression. himraj love
Title Test Details Social Security Number
Expression
^(?!000)([0-6]\d{2}|7([0-6]\d|7[012]))([ -]?)(?!00)\d\d\3(?!0000)\d{4}$
Description
This regex validates U.S. social security numbers, within the range of numbers that have been currently allocated.
Matches
078-05-1120 | 078 05 1120 | 078051120
Non-Matches
987-65-4320 | 000-00-0000 | (555) 555-5555
Author Rating: The rating for this expression. Michael Ash
Title Test Details Pattern Title
Expression
(script)|(&lt;)|(&gt;)|(%3c)|(%3e)|(SELECT) |(UPDATE) |(INSERT) |(DELETE)|(GRANT) |(REVOKE)|(UNION)|(&amp;lt;)|(&amp;gt;)
Description
This Blacklist RegEx is designed to search a user input for any malicious code or SQL injection attempts.
Matches
http://www.domain.com/page.asp?param=&lt;/script&gt; | https://www.domain.com/page.asp?param=;SELECT
Non-Matches
https://www.domain.com/page.asp?param=RealParam
Author Rating: The rating for this expression. Shahar Bracha
Title Test Details Pattern Title
Expression
^([1-9]{1}(([0-9])?){2})+(,[0-9]{1}[0-9]{2})*$
Description
Matchs comma delimited numbers. Easily changed to allow for other delimiters. (Edit &quot;,&quot;) Does not allow a leading 0 Does not allow groups of numbers with less than 3 numbers, exculding the first group.
Matches
123,123,123,123 | 100,120,000,010,011 | 1,123,123,123
Non-Matches
012,123,123,123 | 12343,1244,4,12 | ,123,123,123
Author Rating: The rating for this expression. Gregory Lyons
Title Test Details Pattern Title
Expression
^[{|\(]?[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}[\)|}]?$
Description
Specifier Format of Guid Values that this RegEx supports: 32 digits: [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] 32 digits separated by hyphens: [xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx] 32 digits separated by hyphens, enclosed in brackets: [{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}] 32 digits separated by hyphens, enclosed in parentheses: [(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)]
Matches
914D226A-2F5B-4944-934D-96BBE6571977 | {914D226A-2F5B-4944-934D-96BBE6571977}
Non-Matches
914D226A-2F5B-4944-XXXX-96BBE6571977 | {914D226A-2F5B-4944-XXXX-96BBE6571977}
Author Rating: The rating for this expression. Nicholas Berardi
Title Test Details Pattern Title
Expression
(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{6,15})$
Description
I built this expression to test a string in ASP for valid username and password constraints. It can be adapted for any number of scenerios. For instance in this case, we needed to ensure the username someone wanted was not all numbers or all letters and was 6-15 characters in length with no special characters. This expression tests negatively for all number cases, then all letter cases, and lastly tests for only alphanumeric characters in the required range. In other words: the match must be alphanumeric with at least one number, one letter, and be between 6-15 character in length.
Matches
C2dfeed | sporttrak1 | 11223a
Non-Matches
pookie | d34_fff | 123456
Author Rating: The rating for this expression. Pete Lindquist
Title Test Details Pattern Title
Expression
^[\.\w&#230;&#248;&#229;-]+@([a-z&#230;&#248;&#229;0-9]+([\.-]{0,1}[a-z&#230;&#248;&#229;0-9]+|[a-z&#230;&#248;&#229;0-9]?))+\.[a-z]{2,6}$
Description
Well it pretty much accepts all kinds of users, about the domain i didn't write it special for any TLD so there's no length defined, ohh and it accepts some IDN stuff
Matches
afdaas-ddas----asddas____...@asd.asd.asd.asd.asd.com | a@a.aa | .@microsoft.sun.apple.com
Non-Matches
aaaaaaa@.-com | aaaaaaa@adf.-com | aaaaaaa@
Author Rating: The rating for this expression. Andreas Næsager
Title Test Details Pattern Title
Expression
^([0-9a-fA-F]){8}$
Description
Hex number/string validation method for the Electronic Serial Number(ESN) used in Cellular Phone products.
Matches
8ECCA04F | 82E5AAA4 | 82e5aaa4
Non-Matches
8ECCAOF | 82E5AA4 | 82e5aaa45
Author Rating: The rating for this expression. Cliff Wagner
Title Test Details Pattern Title
Expression
[v,V,(\\/)](\W|)[i,I,1,l,L](\W|)[a,A,@,(\/\\)](\W|)[g,G](\W|)[r,R](\W|)[a,A,@,(\/\\))]
Description
Spam trap Catches many and many way to write viagra (replacing letters with similar chars, spacing chars with one space, etc).
Matches
Viagra | v1@G R /\ | \/iagr@
Non-Matches
viaagra | vi agra | v1 gra
Author Rating: The rating for this expression. Sante Boscolo
Title Test Details Pattern Title
Expression
^([A-Za-z0-9]\s?)+([,]\s?([A-Za-z0-9]\s?)+)*$
Description
This regular expression can be used to parse a comma delimited string. Leading whitespaces (at the beginning of the entire string) and ending commas are not acceptable. Any combination of letters and numbers with zero or one white space between them are acceptable. Note: To change the delimiter, simply replace the comma in the square brackets to the delimiter of choice.
Matches
123, 4567, 8901 | abc, defghi, jklmn | abc123
Non-Matches
abc123 | abc123, | ,abc123
Author Rating: The rating for this expression. Rehan Azam
Title Test Details Pattern Title
Expression
^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$
Description
Matches major credit cards including: Visa (length 16, prefix 4), Mastercard (length 16, prefix 51-55), Discover (length 16, prefix 6011), American Express (length 15, prefix 34 or 37). All 16 digit formats accept optional hyphens (-) between each group of four digits.
Matches
6011-1111-1111-1111 | 5423-1111-1111-1111 | 341111111111111
Non-Matches
4111-111-111-111 | 3411-1111-1111-111 | Visa
Author Rating: The rating for this expression. Steven Smith
Title Test Details Current UK Vehicle Registration
Expression
^([A-HK-PRSVWY][A-HJ-PR-Y])\s?([0][2-9]|[1-9][0-9])\s?[A-HJ-PR-Z]{3}$
Description
UK vehicle registration system currently in use (as defined by the DVLA and put into effect from September 2001, and therefore does not allow registrations prior to this date).
Matches
AB51DVL | AB 51 DVL
Non-Matches
AZ01DLQ | AZ 01 DLQ
Author Rating: The rating for this expression. Amos Hurd
Title Test Details Pattern Title
Expression
^([51|52|53|54|55]{2})([0-9]{14})$
Description
Validate against any mastercard number. All MC's start with a number between 51 and 55 and are followed by 14 other numbers.
Matches
5125632154125412 | 5225632154125412 | 5525632154125412
Non-Matches
5625632154125412 | 4825632154125412 | 6011632154125412
Author Rating: The rating for this expression. Jeff Johns
Title Test Details Pattern Title
Expression
^(?n:(?<lastname>(St\.\ )?(?-i:[A-Z]\'?\w+?\-?)+)(?<suffix>\ (?i:([JS]R)|((X(X{1,2})?)?((I((I{1,2})|V|X)?)|(V(I{0,3})))?)))?,((?<prefix>Dr|Prof|M(r?|(is)?)s)\ )?(?<firstname>(?-i:[A-Z]\'?(\w+?|\.)\ ??){1,2})?(\ (?<mname>(?-i:[A-Z])(\'?\w+?|\.))){0,2})$
Description
This pattern captures &lt;lastname&gt;&lt;suffix&gt;,&lt;prefix&gt;&lt;firstname&gt;&lt;mname&gt; Names must start with a capital letter. Last names may be hyphenated. First names can have two parts ie &quot;Mary Anne&quot; if there are more than two names after the comma. Suffixes can number up to XXX (30th). Standard prefixes are optional (Mr Miss)
Matches
O'Brien, Miles | McDonald,Mary Ann Alison | Windsor-Smith,Barry
Non-Matches
jones, john
Author Rating: The rating for this expression. Michael Ash
Title Test Details Pattern Title
Expression
&lt;[^&gt;]+&gt;
Description
This expression finds all opening and closing tags. Good for stripping out tags in an XML or HTML document. I used it to clean-up HTML documents that had XML mixed in. It found all the tags, then I just deleted the ones that weren't standard. I used it in HOMESITES extended find.
Matches
&lt;html&gt; | &lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt; | &lt;
Non-Matches
Any plain old text | http://www.regexlib.com/Add.aspx | xml&gt;
Author Rating: The rating for this expression. X Man
Change page:   |    Displaying page 1 of 5 pages; Items 1 to 20

Copyright © 2001-2014, RegexAdvice.com | ASP.NET Tutorials