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
([^\.\?\!]*)[\.\?\!]
Description
Finds sentences (assuming they end with a full stop, question mark or exclamation mark).
Matches
This is a series of sentences. They end predictably! Where would we be without punctuation?
Non-Matches
This sentence just trails off
Author Rating: The rating for this expression. Mike Reeves-McMillan
Title Test Details Pattern Title
Expression
^\s*[a-zA-Z,\s]+\s*$
Description
Any Expression Upper/Lower Case, with commas and space between the text, with any amount of space before or after
Matches
Smith, Ed | Ed Smith | aBcDeFgH
Non-Matches
a123 | AB5 | Mr. Ed
Author Rating: The rating for this expression. Mart Maasikas
Title Test Details Pattern Title
Expression
^[A-CEGHJ-PR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1}[0-9]{6}[A-DFM]{0,1}$
Description
UK National Insurance Number (NINo) validation. The following modifications have been made: The first letter may not be D, F, I, Q, U or Z; the second letter may not be D, F, I, O, Q, U or Z; the final letter is optional.
Matches
JG103759A | AP019283D | ZX047829C
Non-Matches
DC135798A | FQ987654C | KL192845T
Author Rating: The rating for this expression. Chris Wicks
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
^([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
^((A[ABEHKLMPRSTWXYZ])|(B[ABEHKLMT])|(C[ABEHKLR])|(E[ABEHKLMPRSTWXYZ])|(GY)|(H[ABEHKLMPRSTWXYZ])|(J[ABCEGHJKLMNPRSTWXYZ])|(K[ABEHKLMPRSTWXYZ])|(L[ABEHKLMPRSTWXYZ])|(M[AWX])|(N[ABEHLMPRSWXYZ])|(O[ABEHKLMPRSX])|(P[ABCEGHJLMNPRSTWXY])|(R[ABEHKMPRSTWXYZ])|(S[ABCGHJKLMNPRSTWXYZ])|(T[ABEHKLMPRSTWXYZ])|(W[ABEKLMP])|(Y[ABEHKLMPRSTWXYZ])|(Z[ABEHKLMPRSTWXY]))\d{6}([A-D]|\s)$
Description
UK National Insurance (NI) Number, updated 14 Dec 2005 and current for 2006.
Matches
NS123456A | AA555555A | ZY654321
Non-Matches
QB123456A | DD123456D | MB654321X
Author Rating: The rating for this expression. Amos Hurd
Title Test Details Pattern Title
Expression
(Ù|Ú|Û|Ü|ù|ú|û|ü|µ|U|u|µ|µ|Ù|Ú|Û|Ü|Ù|Ú|Û|Ü|ù|ú|ûü|ù|ú|û|ü)
Description
Spam stopper, catches any non english characters for u used in flocks
Matches
Üsúally $40 | únless you act | µpper limit
Non-Matches
Usually $40 | unless you act | upper limit
Author Rating: The rating for this expression. Alanski Perryman
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
^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*<>:\;|\"/]+$
Description
Additional checks for <> and " characters
Matches
abc
Non-Matches
PRN
Author Rating: The rating for this expression. Rahul Pandit
Title Test Details Pattern Title
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})$
Description
UK vehicle registration system prior to September 2001. Allows both older suffix and the later prefix formats in simple form, with optional spaces.
Matches
ABC123A | A 123 ABC
Non-Matches
AB123A | A 123 AB
Author Rating: The rating for this expression. Amos Hurd
Title Test Details Pattern Title
Expression
(.)\1{2,}
Description
matches any string with characters repeated more than twice, sometimes used as fake input
Matches
aaaeee | ???????? | gooogle
Non-Matches
google | booboo
Author Rating: The rating for this expression. Bernard Martin-Rabaud
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 ",") 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
^[\.\wæøå-]+@([a-zæøå0-9]+([\.-]{0,1}[a-zæøå0-9]+|[a-zæøå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-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
^((Bob)|(John)|(Mary)).*$(?<!White)
Description
&quot;Starts with but does not end with.&quot; I needed a pattern to require certain first (and optional middle) names, but to fail for certain last names. So if Bob, John, and Mary are acceptable first names but the White's are always rejected then...
Matches
Bob Jones | John Smith | Mary Jane Smith
Non-Matches
Bob White | Mary Doe White | Gina Smith
Author Rating: The rating for this expression. Eli Robillard
Title Test Details Pattern Title
Expression
"[^"\r\n]*"
Description
returns string between two quotes
Matches
Return Parent.DB.GetDataReader("CauseImmediateGet", MyIncidentEventTypeID)
Non-Matches
Return Parent.DB.GetDataReader(CauseImmediateGet", MyIncidentEventTypeID)
Author Rating: The rating for this expression. Sonal Bordia
Title Test Details Pattern Title
Expression
^\.([rR]([aA][rR]|\d{2})|(\d{3})?)$
Description
RAR file extensions. Works also with '*.part01.rar' given '.rar' to be the file extension. Does not support volumes exceed 101 for s## (r99, s00, s01, ...) serie.
Matches
.RAr | .r01 | .012
Non-Matches
.rxr | .a01 | .0112
Author Rating: The rating for this expression. Jack Yang
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
^([6011]{4})([0-9]{12})$
Description
Validate against any discover card number. All DC's start with 6011 and are followed by 12 other numbers.
Matches
6011212541254121 | 6011523654125685
Non-Matches
5021152365212541 | 601126523652321 | 60112563212563215
Author Rating: The rating for this expression. Jeff Johns
Title Test Details Pattern Title
Expression
(\S+)\x20{2,}(?=\S+)
Description
Trim Inside. This pattern can be used with a replace value of &quot;$1 &quot; to remove multiple consecutive spaces between characters and replace with a single space. Trailing and leading spaces are NOT altered.
Matches
Too Many spaces.
Non-Matches
No extra spaces | No Extra spaces Inside
Author Rating: The rating for this expression. Michael Ash
Change page:   |    Displaying page 1 of 5 pages; Items 1 to 20

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