Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

regex pattern for bank cards validation

// NOTE: This is just example how could be done,
// real card validations have some additional rules.
// Please see source link for more details...

// A Visa card starts with 4 and has the length of 16 digits.
// A MasterCard starts with the numbers from 51 to 55, or the numbers 2221 to 2720. All have 16 digits.
// American Express card numbers start with 34 or 37 and have 15 digits.
String visaRegex = "^4[0-9]{15}";
String masterCardRegex = "5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|720[0-9]{12})";
String americanExpressRegex = "3[4-7][0-9]{13}";
Comment

PREVIOUS NEXT
Code Example
Java :: enhanced for loop with arraylist 
Java :: char to ascii java 
Java :: java iterate map and remove 
Java :: what is inflater in android 
Java :: convert int to byte java 
Java :: javafx arabic letters 
Java :: how to check number format exception in java 
Java :: how to create a gui in java 
Java :: find highest value in keyset java 
Java :: how to use a combo box in java with if else 
Java :: Imageview on the bottom left of Imageview android anchor 
Java :: indexof an array in java 
Java :: recursion in java 
Java :: get arguments in fragment kotlin 
Java :: bubble sort in java 
Java :: java split string without removing 
Java :: java ignore catch 
Java :: phone number format java 
Java :: retrofit 
Java :: java concatenate strings 
Java :: valueof in java 
Java :: class, interface, or enum expected java 
Java :: Java Hashmap Add Elements 
Java :: convert object array to int array java 
Java :: char array to string in java 
Java :: how to disable screenshot in react native 
Java :: pass a function as parameter 
Java :: BodyContentImpl memory leak 
Java :: java convert ip to long 
Java :: java generic type method 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =