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}))(-?|\040?)(\d{4}(-?|\040?)){3}|^(3[4,7]\d{2})(-?|\040?)\d{6}(-?|\040?)\d{5}
Description
Credit card validator for AMEX, VISA, MasterCard only. Allows spaces, dashes, or no separator between digit groups according to the layout (4-6-5 for AMEX, 4-4-4-4 for Visa and Mastercard)
Matches
3711-078176-01234 | 4123 5123 6123 7123 | 5123412361237123
Non-Matches
3711-4123-5123-6112
Author Rating: Not yet rated. Rick Spiewak
Source Modified from other examples
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: soapui
Name: sejal
Date: 7/12/2016 4:55:37 AM
Comment:
hi,we provide online training & video tutorial for soapui for free videos refer http://soapui-tutorial.com/soapui-tutorial/introduction-to-webservices/


Title: a 'better' pattern
Name: freddoo
Date: 2/6/2008 1:28:35 PM
Comment:
Hi your pattern was very nice but it's missing the end marker i came up with this one ( with end marked and changed the optional space dash ) ^((4\d{3})|(5[1-5]\d{2}))[ -]?(\d{4}[ -]?){3}$|^(3[4,7]\d{2})[ -]?\d{6}[ -]?\d{5}$


Title: Grouping regular expressions
Name: rk
Date: 1/11/2008 2:30:35 PM
Comment:
Hi, looks like you have used grouping. I needed to validate some thing like this 5000,5500-8668,9779 -- valid.. 5000,5500-8668-8686,9779 -- Invalid.. I got all other posibility captured but am not able to capture this one.... Could u advice some thing... Thanks in advance


Title: Grouping regular expressions
Name: rk
Date: 1/11/2008 2:30:20 PM
Comment:
Hi, looks like you have used grouping. I needed to validate some thing like this 5000,5500-8668,9779 -- valid.. 5000,5500-8668-8686,9779 -- Invalid.. I got all other posibility captured but am not able to capture this one.... Could u advice some thing... Thanks in advance


Title: mr
Name: hhr
Date: 6/29/2007 11:24:56 AM
Comment:
also validating 465156194960561685316156165100163765144557464641566515665


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