I am trying to write code that returns a credit card vendor using regular expression, which seem to work, eg:
// Visa - always begins digit 4, 13 or 16 digits long
^[4].{12}|^[4].{15} 
// Visa Electron - begin with the code pattern, 16 digits long
4026.{12}|417500.{10}|4405.{12}|4508.{12}|4844.{12}|4913.{12}|4917.{12}
So for a method isVisa I want the regex to say "return Visa based on the Visa regex, but not Visa Electron"
This code does not work:
    public static String isVisa(String number) {
    Pattern p = Pattern.compile("^[4].{12}|^[4].{15}&&(!4026.{12}|!417500.{10}|!4405.{12}|!4508.{12}|!4844.{12}|!4913.{12}|!4917.{12})");
    Matcher m = p.matcher(number);
    if (m.matches()) return "Visa";
    else return "";
}
 
     
     
     
    