How to verify PAN card?

前端 未结 15 1358
予麋鹿
予麋鹿 2021-02-13 11:46

How to check the validation of edittext for pan card like \"ABCDE1234F\". I am confused how to check the the validation for this. Please help me guys. I will appreciate any kind

15条回答
  •  醉梦人生
    2021-02-13 12:09

    public static boolean isPanCardValid(String pan_number) {
    
      Pattern pattern = Pattern.compile("[A-Z]{5}[0-9]{4}[A-Z]{1}");
    
      Matcher matcher = pattern.matcher(pan_number);
      // Check if pattern matches
      if (matcher.matches()) {
        return true;
      } else {
        return false;
      }
    }

提交回复
热议问题