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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^((?:4\d{3})|(?:5[1-5]\d{2})|(?:6011)|(?:3[68]\d{2})|(?:30[012345]\d))[ -]?(\d{4})[ -]?(\d{4})[ -]?(\d{4}|3[4,7]\d{13})$
Description
This just a minor mod to Steven Smith's credit card re to accept spaces as separators, as well as return the four parts of the card. [Updated Oct-18-2002 to work with Diners Club/Carte Blanche (prefix must be 36, 38, or 300-305)]
Matches
6011567812345678 | 6011 5678 1234 5678 | 6011-5678-1234-5678
Non-Matches
1234567890123456
Author Rating: The rating for this expression. Glenn Carr
Source Glenn Carr (glenn at glenncarr dot com)
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: no amex support
Name: bryan costanich
Date: 1/2/2009 8:33:34 PM
Comment:
does not work with amex numbers, either with or without spaces


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