RegExp for Indian Bank Account Number - regex

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?

RBI dictates certain rules like you've mentioned over Indian Bank Account Number structures (9 - 18).
Most of the banks have unique account numbers.
Account number length varies from 9 digits to 18 digits.
Most of the banks (67 out of 78) have included branch code as part of the account number structure. Some banks have product code as part of the account number structure.
40 out of 78 banks do not have check digit as part of the account number structure.
All banks have purely numeric account numbers, except one or two foreign banks.
Only in the case of 20 banks, account numbers are formed without any pattern with a unique running serial number.
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.

According to RBI Reserve Bank of India
-> The bank should have 9-18 digits
"[0-9]{9,18}"

Related

Regex for Bank Account Number and Bank Routing Number

Does anyone know which is the format for these two criteria?
Bank Account Number
Bank Routing Number
I am interested in what format regex for two.
I look forward to a response from you
Thanks in advance!
Routing numbers (at least in the US) are always 9 digits. See routing numbers on Wikipedia for a thorough breakdown of how the routing number is structured and what values are acceptable. (Note: Regex is almost certainly not what you want to use to validate these.)
Account numbers are of arbitrary length and value, as defined by the individual bank. It cannot be validated without checking with the bank in question.
All this, and more, was asked and answered in this SO question.

Regular expression for all bank card numbers

I am using a regular expression to match all UK bank card number formats; I have done research and managed to find/amend a regex that covers the majority of formats. However, I have a bit of an edge case where one is not matching and I do not know why, or how to resolve. This is what I am using:
(\b[4|5|6](\d){3}[\s|-]?((\d){4}[\s|-]?){2}(\d){4}\b)|(\b(\d){4}[\s|-]?(\d){6}[\s|-]?(\d){5}\b)
This is an example card number that does not work: 6759000000005
This is an example card number that does work: 675900000000555
Apologies if this is an easy question, I am fairly new to regular expression syntax. Any help to resolve would be greatly appreciated. Thanks.
See here the demo
The regex is (\b[4|5|6]\d{3}[\s-]?(\d{4}[\s-]?){2}\d{1,4}\b)|(\b\d{4}[\s-]?\d{6}[\s-]?\d{5}\b)
I'm not an expert of UK cards, so I can't tell what is the expected format as you did not gave exemples with spaces or hyphens in them...
If you can refine the requirements it's handlable.
A more generic card number validation (without separators, so you'll need to strip them before) would be
\d{6}\d{1,12}\d
As per the requirements of the norm (found nothing on the minimum length of the account identifier):
An ISO/IEC 7812 card number is most commonly 16 digits in length,[1]
and can be up to 19 digits. The structure is as follows:
a six-digit Issuer Identification Number (IIN) (previously called the
"Bank Identification Number" (BIN)) the first digit of which is the
Major Industry Identifier (MII), a variable length (up to 12 digits)
individual account identifier, a single check digit calculated using
the Luhn algorithm.[2]

Which format mask of phone number is safe for input for all countries?

I am making an input form for registering employees. I thought the number format in any country would fit in /\+(\d+)-\d\d\d-\d\d\d-\d\d\d\d/, where (\d+) is country code I assume to have different length and next goes exactly 10 digits. I need to create input fields and validation rules to make input as protected and unambiguous as possible but I am also worried if there could be actual numbers that don't fit this regex. Is there a safe international standard way of writing numbers?
There is no particular format which you can apply for all the countries phone number.
However \d* will be one of the choice with which you can proceed with but that too is not the best.
You may check National conventions for writing telephone numbers

Convert alphanumeric string to 16 digit GCID

I'm building our inventory feed for Amazon Seller Central in OpenOffice Calc but can't work out how to convert our inhouse product IDs to the Amazon required format GCID.
The standard-product-id must have a specific number of characters according to type: GCID (16 alphanumeric characters), UPC (12 digit number), EAN (13 digit number) or GTIN(14 digit number).
Our product IDs vary by manufacturer, eg:-
123456
AB123456
1234AB
Where the ID is numerical only I can format the cells with leading zeros, however this doesn't work if the cell contains letters.
My file has over 10,000 products so I'm wondering if there is a formula I can apply to all cells to instantly convert them to GCID?
It seems the question was asked when under a misapprehension but having noticed that the example 123456 AB123456 1234AB represents three different IDs and aware that padding to a specified length is quite a common requirement (eg see String.PadLeft Method) a suggestion for OpenOffice might be of use to someone, one day.
Convention is to pad with 0s but since some spreadsheets automatically strip these off the front of numbers (as first example) and databases tend to prefer that fields are of consistent format I suggest separating the padding from the example with a hyphen, to aid identification of alpha numeric codes and to force text format:
=REPT(0;15-LEN(A1))&"-"&A1

RegEx for valid international mobile phone number [duplicate]

This question already has answers here:
What regular expression will match valid international phone numbers?
(23 answers)
Closed 8 years ago.
I use Clickatell to send SMSes to clients' mobile phones.
Is there a standardised regular expression for all valid mobile phone numbers, e.g. +27 123 4567? I'd roll my own, but I'm worried about missing an obscure, valid phone number format.
After stripping all characters except '+' and digits from your input, this should do it:
^\+[1-9]{1}[0-9]{3,14}$
If you want to be more exact with the country codes see this question on List of phone number country codes
However, I would try to be not too strict with my validation. Users get very frustrated if they are told their valid numbers are not acceptable.
Even if you write a regular expression that matches exactly the subset "valid phone numbers" out of strings, there is no way to guarantee (by way of a regular expression) that they are valid mobile phone numbers. In several countries, mobile phone numbers are indistinguishable from landline phone numbers without at least a number plan lookup, and in some cases, even that won't help. For example, in Sweden, lots of people have "ported" their regular, landline-like phone number to their mobile phone. It's still the same number as they had before, but now it goes to a mobile phone instead of a landline.
Since valid phone numbers consist only of digits, I doubt that rolling your own would risk missing some obscure case of phone number at least. If you want to have better certainty, write a generator that takes a list of all valid country codes, and requires one of them at the beginning of the phone number to be matched by the generated regular expression.
^\+[1-9]{1}[0-9]{7,11}$
The Regular Expression ^\+[1-9]{1}[0-9]{7,11}$ fails for "+290 8000" and similar valid numbers that are shorter than 8 digits.
The longest numbers could be something like 3 digit country code, 3 digit area code, 8 digit subscriber number, making 14 digits.
Posting a note here for users looking into this into the future. Google's libphonenumber is what you most likely would want to use. There is wrappers for PHP, node.js, Java, etc. to use the data which Google has been collecting and reduces the requirements for maintaining large arrays of regex patterns to apply.
Even though it is about international numbers I would want the code to be like :
/^(\+|\d)[0-9]{7,16}$/;
As you can have international numbers starting with '00' as well.
Why I prefer 15 digits : http://en.wikipedia.org/wiki/E.164
// Regex - Check Singapore valid mobile numbers
public static boolean isSingaporeMobileNo(String str) {
Pattern mobNO = Pattern.compile("^(((0|((\\+)?65([- ])?))|((\\((\\+)?65\\)([- ])?)))?[8-9]\\d{7})?$");
Matcher matcher = mobNO.matcher(str);
if (matcher.find()) {
return true;
} else {
return false;
}
}