Reputation: 790
I need to write a regular expression to check for valid bank account number format of major banks in India. Does anyone know what regular expression check should be? Perhaps I just check to make sure all characters are digits?
Upvotes: 3
Views: 35999
Reputation: 1
Name Field Validation for Account holder name by using Regex in java
public static boolean nameFieldValidation(String name) {
System.err.println("Name field input ::::" + name);
logger.info("nameFieldValidation() :: Start :::");
try {
if (name == null || name.isEmpty()) {
return false;
}
final String NAME_PATTERN = "^(?!\\s|\\.)(?!.*(?:\\s{2}|\\.{2}))[a-zA-Z\\.\\s]+[a-zA-Z]$";
Pattern pattern = Pattern.compile(NAME_PATTERN);
Matcher matcher = pattern.matcher(name);
boolean matches = matcher.matches();
logger.info(" nameFieldValidation() :: End :::");
return matches;
} catch (Exception e) {
logger.error("Error occurred during name verification: :: Exception ::" + e.getMessage());
return false;
}
}
Upvotes: 0
Reputation: 4981
RBI dictates certain rules like you've mentioned over Indian Bank Account Number structures (9 - 18).
Indian Bank Account Number Validation Regex:
^\d{9,18}$
A better way to validate would be to select the right bank and then have checks in place as per the bank which have been outlined and analyzed by the RBI here.
Upvotes: 32
Reputation: 790
According to RBI Reserve Bank of India -> The bank should have 9-18 digits
"[0-9]{9,18}"
Upvotes: 4