Validate a credit card number
Posted: Tue Apr 26, 2016 5:46 am
I have this script to validate a credit card number with this condition:
The number must be within this range [222100-272099]
I started a little bit but I still dry in the regexp
Thank you for your help !
The number must be within this range [222100-272099]
I started a little bit but I still dry in the regexp
Thank you for your help !
- Title = "Valid card number or not"
- CardNumber = InputBox("Please type your card number ",Title,"222100")
- if IsValidcard(CardNumber) = True Then
- MsgBox CardNumber & " The Card number is valid !",64,Title
- else
- MsgBox CardNumber & " The Card number is not valid !",16,Title
- End if
- Function IsValidCard(Num)
- Set RegularExpressionObject = New RegExp
- With RegularExpressionObject
- .Pattern = "^(2221[0-9][0-9])|(2[2-7]20[0-9][0-9])$"
- .IgnoreCase = False
- If .Test(Num)= True then
- IsValidCard = True
- end if
- End With
- End Function