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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find 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 "-" or a " " 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
Source
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: Help needed
Name: BlagojaP
Date: 9/24/2010 5:52:49 PM
Comment:
Hi How can I use this but make it more simple. I need just digits (not grouped by 4). Just digits, - and blank spaces. Thanks


Title: Help needed
Name: BlagojaP
Date: 9/24/2010 5:46:13 PM
Comment:
Hi How can I use this but make it more simple. I need just digits (not grouped by 4). Just digits, - and blank spaces. Thanks


Title: very good
Name: credit card
Date: 12/2/2005 8:11:02 AM
Comment:
Thanks


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