kw66722
asked on
Checking Credit Card number is valid
I need to check whether is credit card number is a valid format for the type of credit card that is giving to me. I am passing the number to other place that will do the actual check. I had found this
for each card when I tested with actual number for the particular type for card I got errors. Am I missing something in the regular expression?
This is be coded in VBNET on the back end.
Case "AX"
RegEx = New System.Text.RegularExpress ions.Regex ("3[4,7]\d {13}")
Case "DS"
RegEx = New System.Text.RegularExpress ions.Regex ("6011-?\d {4}-?\d{4} -?\d{4}")
Case "MC"
RegEx = New System.Text.RegularExpress ions.Regex ("5[1-5]\d {2}-?\d{4} -?\d{4}-?\ d{4}")
Case "VA"
RegEx = New System.Text.RegularExpress ions.Regex ("4\d{3}-? \d{4}-?\d{ 4}-?\d{4}" )
for each card when I tested with actual number for the particular type for card I got errors. Am I missing something in the regular expression?
This is be coded in VBNET on the back end.
Case "AX"
RegEx = New System.Text.RegularExpress
Case "DS"
RegEx = New System.Text.RegularExpress
Case "MC"
RegEx = New System.Text.RegularExpress
Case "VA"
RegEx = New System.Text.RegularExpress
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER