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 4 of 5 pages; Items 61 to 80
Title Test Details Pattern Title
Expression
(\d{6}[-\s]?\d{12})|(\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4})
Description
Credit card validator Works for switch card numbers too Switch card bit is (\d{6}[-\s]?\d{12}) Credit card bit is (\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}) I use this as a client side test before running a more comprehensive server side check.
Matches
5111 1111 1111 11118 | 1234123412341324 | 123456 123456789012
Non-Matches
511a 1111 1111 11118
Author Rating: Not yet rated. Joe Gass
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: Not yet rated. Bernard Martin-Rabaud
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{1,3}|St\.\s)?[A-Z]\w+\-?[A-Z]?\w*)(?:,\s|)(?<Suffix>Jr\.|Sr\.|IV|III|II|)
Description
Getting closer now... this one has the functionality of the previous two and matches on names like &quot;Jill St. John&quot; as well.
Matches
David F. Walker | Norm MacDonald | Jill St. John
Non-Matches
oscar peterson
Author Rating: Not yet rated. David Walker
Title Test Details Pattern Title
Expression
(?<LastName>[A-Z]\w+\-?[A-Z]?\w*),\s(?<Suffix>Jr\.|Sr\.|IV|III|II)?,?\s?(?<FirstName>[A-Z]\w*\-?[A-Z]?\w*\.?)\s?(?<MiddleName>[A-Z]?\w*\.?)
Description
Regex parses elements from a proper name in &lt;&lt;Last, First&gt;&gt; order and permutations. Comments and critiques are welcome.
Matches
Walker, David F | Smith, Jr., J. S. | DeCarlo, Yvonne
Non-Matches
peterson, oscar
Author Rating: Not yet rated. David Walker
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: Not yet rated. Steven Smith
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 protected] | My Name | asdf12df
Non-Matches
‘,\*&amp;$&lt;&gt; | 1001' string
Author Rating: Not yet rated. Paul Miller
Title Test Details Pattern Title
Expression
^(\d{4}[- ]){3}\d{4}|\d{16}$
Description
Credit card validator. Just checks that the format is either 16 numbers in groups of four separated by a &quot;-&quot; or a &quot; &quot; or nothing at all.
Matches
1234-1234-1234-1234 | 1234 1234 1234 1234 | 1234123412341234
Non-Matches
Visa | 1234 | 123-1234-12345
Author Rating: Not yet rated. Steven Smith
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: Not yet rated. Mart Maasikas
Title Test Details Pattern Title
Expression
^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*&lt;&gt;:\;|\&quot;/]+$
Description
Additional checks for &lt;&gt; and &quot; characters
Matches
abc
Non-Matches
PRN
Author Rating: Not yet rated. Rahul Pandit
Title Test Details Pattern Title
Expression
(NOT)?(\s*\(*)\s*(\w+)\s*(=|&lt;&gt;|&lt;|&gt;|LIKE|IN)\s*(\(([^\)]*)\)|'([^']*)'|(-?\d*\.?\d+))(\s*\)*\s*)(AND|OR)?
Description
Heres my sql clause parser regexp for recordset filtering. Does recursive query parsing all by its self. Only problem I cant figure is how to match comma separated lists of quoted strings. Tell me if you figure out how! The unicodes in the re was put in by the entry form please replace them with their ascii equivalents to use it.
Matches
Aeroplane LIKE 767 | Movie LIKE 'Star' AND NOT Movie LIKE 'Trek' | Number IN (1,2,3,4,5)
Non-Matches
Hello there | A=EXCELLENT OR | B!=POOR
Author Rating: Not yet rated. Joseph Warwick
Title Test Details Pattern Title
Expression
(?s)(?:\e\[(?:(\d+);?)*([A-Za-z])(.*?))(?=\e\[|\z)
Description
This expression will match all of the commands(escape codes) used in ANSI files. These are what were used to create the colors/blocks on BBS's for those of us that once dialed into them. http://www.wikipedia.org/wiki/ANSI_escape_code has a reference for ANSI escape codes. http://idledreams.net/lordscarlet/posts/153.aspx shows an example of the engine I have created surrounding the expression
Matches
Hello | Test | 
Non-Matches
abc
Author Rating: Not yet rated. Doug Moore
Title Test Details Pattern Title
Expression
^([a-z0-9]+([\-a-z0-9]*[a-z0-9]+)?\.){0,}([a-z0-9]+([\-a-z0-9]*[a-z0-9]+)?){1,63}(\.[a-z0-9]{2,7})+$
Description
[Note: this regex was tested with Macromedia's ColdFusion MX. I'm sure it'll need some massaging to work with other regex engines.] Of the few domain validating regular expressions I found in my search I didn't find a single one that reliably handled multiple levels of subdomains or TLDs. So, I wrote one and thoroughly tested it. There are a ton of matching and non-matching examples that need to be included to show the completeness of this regex. Non-matching: -.domain.com, -a.domain.com, -domain.com, domain-.com, any domain where the portion before the tld is greater than 63 characters. Matching: a.domain.com, a-a.domain.com, a--a.domain.com, a--defg.com, domain.co.uk.
Matches
800-med-alert.com | jump.to | archive-3.www.regexlib.com
Non-Matches
example | a-.domain.com | http://regexlib.com/
Author Rating: Not yet rated. Jeff Howden
Title Test Details Pattern Title
Expression
^(?![0-9]{6})[0-9a-zA-Z]{6}$
Description
matches a six character &quot;password&quot; that has to consist of numbers and letters with at least one letter in it.
Matches
123a12 | a12345 | aaaaaa
Non-Matches
111111
Author Rating: Not yet rated. James T. Kirk
Title Test Details Pattern Title
Expression
^\d{3}\s?\d{3}\s?\d{3}$
Description
Social Insurance Number validator. Canadians only need apply. If somebody could help me (I'm bad at regex), I would like to modify this so that if there is one space after the 3rd digit (or 6th) then there must be one after the 6th (or third).
Matches
123 456 789 | 123456789 | 123 456789
Non-Matches
1234 5678 9 | 123 456 7890 | 123
Author Rating: Not yet rated. Matt Martens
Title Test Details Pattern Title
Expression
^\d{3}-\d{2}-\d{4}$
Description
This regular expression will match a hyphen-separated Social Security Number (SSN) in the format NNN-NN-NNNN.
Matches
333-22-4444 | 123-45-6789
Non-Matches
123456789 | SSN
Author Rating: Not yet rated. Steven Smith
Title Test Details Pattern Title
Expression
.*[Pp]re[Ss\$]cr[iI1]pt.*
Description
Spam Stopper
Matches
Pre$criptions
Non-Matches
na
Author Rating: Not yet rated. Alanski Perryman
Title Test Details Pattern Title
Expression
.*[Pp]en[Ii1][\$s].*
Description
Spam Stopper
Matches
penis
Non-Matches
na
Author Rating: Not yet rated. Alanski Perryman
Title Test Details Pattern Title
Expression
^[a-zA-Z]+(([\'\,\.\-][a-zA-Z])?[a-zA-Z]*)*$
Description
This allows you to validate first names and last names in seperate fields. Instead of validating a full name in one field.
Matches
Sameul | O'Conner | Mary-Kate
Non-Matches
David Bugel | Robert1 | Robert M. Larry
Author Rating: Not yet rated. Hayk A
Title Test Details Pattern Title
Expression
^(?:(?<Visa>4\d{3})|(?<Mastercard>5[1-5]\d{2})|(?<Discover>6011)|(?<DinersClub>(?:3[68]\d{2})|(?:30[0-5]\d))|(?<AmericanExpress>3[47]\d{2}))([ -]?)(?(DinersClub)(?:\d{6}\1\d{4})|(?(AmericanExpress)(?:\d{6}\1\d{5})|(?:\d{4}\1\d{4}\1\d{4})))$
Description
Updated on 7 Jun 2005 -- Matches major credit cards including: Visa (length 16, prefix 4); Mastercard (length 16, prefix 51-55); Diners Club/Carte Blanche (length 14, prefix 36, 38, or 300-305); Discover (length 16, prefix 6011); American Express (length 15, prefix 34 or 37). Saves the card type as a named group to facilitate further validation against a &quot;card type&quot; checkbox in a program. All 16 digit formats are grouped 4-4-4-4 with an optional hyphen or space between each group of 4 digits. The American Express format is grouped 4-6-5 with an optional hyphen or space between each group of digits. Formatting characters must be consistant, i.e. if two groups are separated by a hyphen, all groups must be separated by a hyphen for a match to occur.
Matches
4111-2222-3333-4444 | 3411 222222 33333 | 5111222233334444
Non-Matches
4111-2222-3333-444 | 3411-2222-3333-4444 | Visa
Author Rating: Not yet rated. Jerry Schmersahl
Title Test Details Pattern Title
Expression
(?n:(^(?(?![^,]+?,)((?<first>[A-Z][a-z]*?) )?((?<second>[A-Z][a-z]*?) )?((?<third>[A-Z][a-z]*?) )?)(?<last>[A-Z](('|[a-z]{1,2})[A-Z])?[a-z]+))(?(?=,)(, (?<first>[A-Z][a-z]*?))?( (?<second>[A-Z][a-z]*?))?( (?<third>[A-Z][a-z]*?))?)$)
Description
Regular expression for validating a person's full name. Matches on two general formats: 1) first second third last (where first, second, and third names are optional and all present are separated by a space); 2) last, first second third (where second and third are optional, last is followed immediately by a comma and a space, and second, and third, if present, are separated by a space from each other and from first). First corresponds to surname and last corresponds to family name. Each name part is captured to a named group to facilitate program manipulation. Each name part must begin with an uppercase letter, followed by zero or more lowercase letters, except for the last name. Last name must begin with an uppercase letter, followed by one or more lowercase letters, but will match exceptions formatted like the following: McD..., MacD..., O'R... Only format is validated, not spelling. NOTE: This regular expression uses positive and negative regex lookahead to determine the general format of the name, i.e. the presence or the absence of the comma determines the general format that will match. Furthermore, this initial version is not designed to accommodate titles and things like &quot;3rd&quot;.
Matches
John Paul Jones | Jones, John P | Jones
Non-Matches
Paul Jones, John | John J | Mr. John Paul Jones 3rd
Author Rating: Not yet rated. Jerry Schmersahl
Change page:   |    Displaying page 4 of 5 pages; Items 61 to 80

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