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 Combined UK Vehicle Registration
Expression
^([A-Z]{3}\s?(\d{3}|\d{2}|d{1})\s?[A-Z])|([A-Z]\s?(\d{3}|\d{2}|\d{1})\s?[A-Z]{3})|(([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. This is the obvious combination of two previous expressions posted here, to merge the older system with the current system.
Matches
ABC 123 A | A 123 ABC | AB 12 ABC
Non-Matches
AB 123 C | A 123 AB | AB 12 AB
Author Rating: The rating for this expression. Amos Hurd
Title Test Details Pattern Title
Expression
(^|\s)(00[1-9]|0[1-9]0|0[1-9][1-9]|[1-6]\d{2}|7[0-6]\d|77[0-2])(-?|[\. ])([1-9]0|0[1-9]|[1-9][1-9])\3(\d{3}[1-9]|[1-9]\d{3}|\d[1-9]\d{2}|\d{2}[1-9]\d)($|\s|[;:,!\.\?])
Description
Incorporated other people's examples; removed extraneous parenthesis on 10/7/04. Currently the SSA site says 772 is the highest AREA number generated (http://www.ssa.gov/employer/highgroup.txt). Old expression was: (^|\s)\d{3}(-?|[\. ])\d{2}\2\d{4}($|\s|[;:,!\.\?]). Looks for either the beginning of a line or whitespace before the beginning of the social security number, then either zero or one hyphen OR one of a period or space, then uses the \3 to reference the value returned in the parenthesis that includes the -?|[\. ] (basically says if the first dash, period, or space is there, then the second one is required; and if the first dash, period, or space is not there, then the second one can't be either), and finally looks for the end of a line, whitespace, or punctuation characters after the social security number.
Matches
123-45-6789 | 123 45 6789 | 123456789
Non-Matches
12345-67-890123 | 1234-56-7890 | 123-45-78901
Author Rating: The rating for this expression. Dennis Flynn
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
^ISBN\s(?=[-0-9xX ]{13}$)(?:[0-9]+[- ]){3}[0-9]*[xX0-9]$
Description
This pattern validates ISBN numbers. I've written a full description about it here: http://regexblogs.com/dneimke/posts/201.aspx
Matches
ISBN 90-70002-34-5 | ISBN 90-70002-34-x
Non-Matches
ISBN 90-70002-34-5x | ISBN 90-700-02-34-5
Author Rating: The rating for this expression. Darren Neimke
Title Test Details ISBN-10
Expression
ISBN\x20(?=.{13}$)\d{1,5}([- ])\d{1,7}\1\d{1,6}\1(\d|X)$
Description
This RE validates the format of an ISBN number
Matches
ISBN 0 93028 923 4 | ISBN 1-56389-668-0 | ISBN 1-56389-016-X
Non-Matches
123456789X | ISBN 9-87654321-2 | ISBN 123 456-789X
Author Rating: The rating for this expression. Michael Ash
Title Test Details Pattern Title
Expression
^([30|36|38]{2})([0-9]{12})$
Description
Validate against any diner's club card. All diner club cards start with 30,36, or 38, followed by 12 other numbers.
Matches
30125212365212 | 36125212365212 | 38125212365212
Non-Matches
301252123652121 | 40256631125452 | 361251254125212
Author Rating: The rating for this expression. Jeff Johns
Title Test Details Pattern Title
Expression
^(?!000)(?!666)(?<SSN3>[0-6]\d{2}|7(?:[0-6]\d|7[012]))([- ]?)(?!00)(?<SSN2>\d\d)\1(?!0000)(?<SSN4>\d{4})$
Description
Updated on 3/4/2004 per feedback to additionally exclude SSNs that begin with 666 which, as reported, are also not valid. Regular expression for validating US Social Security Numbers. Accepts optional hyphens or spaces as formatting characters. Parses the three subfields of the SSN into three named sub-strings (SSN1, SSN2, and SSN3) to facilitate program use. Rejects matches on all zeros for any individual subfield of the Social Security Number. Matches only on those SSNs that fall within the range of numbers currently allocated by the Social Security Administration.
Matches
111223333 | 111-22-3333 | 111 22 3333
Non-Matches
111003333 | 111 22-3333 | 666-22-3333
Author Rating: The rating for this expression. Jerry Schmersahl
Title Test Details Pattern Title
Expression
(\b)(\w+(\b|\n|\s)){3}
Description
This script attempts to return phrases from a string (Example above looks for {3} word phrases) Combine this with some .Net code, you can display most popular X word phrases in a string. -If anyone can help me count &quot;Phrase and Phrase as 2 instances of Phrase please contact me
Matches
three blind mice | see how they run
Non-Matches
three blind | they run
Author Rating: The rating for this expression. Dan Hall
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 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
^([A-Z|a-z|&amp;]{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
^(?=.*\d)(?=.*[a-zA-Z])(?!.*[\W_\x7B-\xFF]).{6,15}$
Description
Password validator Requires 6-20 characters including at least 1 upper or lower alpha, and 1 digit. It should disallow just about everything else, inluding extended characters.
Matches
abc123 | BA99342bob | 1232z123311
Non-Matches
abcdef | 123456 | 123'ABC
Author Rating: The rating for this expression. Tim Conama
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 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
^\d{9}[\d|X]$
Description
A very simple ISBN validation expression - it just checks for a 10 digit number where the last digit could also be a capital 'X'. Complete specs for ISBN available here: http://www.isbn.org/standards/home/isbn/international/html/usm4.htm. An enhancement would be to allow exactly 3 or 0 hyphens or 3 or 0 spaces, since these are also valid formats.
Matches
1234123412 | 123412341X
Non-Matches
not an isbn
Author Rating: The rating for this expression. Steven Smith
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
^([A-Z]{1}[a-z]{1,})$|^([A-Z]{1}[a-z]{1,}\040[A-Z]{1}[a-z]{1,})$|^([A-Z]{1}[a-z]{1,}\040[A-Z]{1}[a-z]{1,}\040[A-Z]{1}[a-z]{1,})$|^$
Description
Matches up to three alphabet words separated by spaces with first alphabet character of each word uppercase. Also matches empty strings.
Matches
Sacramento | San Francisco | San Luis Obispo
Non-Matches
SanFrancisco | SanLuisObispo | San francisco
Author Rating: The rating for this expression. Don Batchelor
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
^[{|\(]?[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
^(?=[^\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
Change page:   |    Displaying page 1 of 5 pages; Items 1 to 20

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