Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Does java regular expression judge whether it is a bank card number?
Does java regular expression judge whether it is a bank card number?
The bank card number cannot be judged.

The judgment of law can only be made according to the characteristics of this number.

For example, a bank card is characterized by a number of *** 19, all of which are numbers.

The general formula is "\ \ d {19} $".

system.out.println(st.matches("^\\d{ 19}$”);

If it is not 19 digits, it will print false. If it is, it will output true.

Are there any other features? Different banks may have their own characteristics. You should ask the bank about this.

Regular expressions, also known as regular expressions. (English: regular expression, often abbreviated as regex, regexp or re in code), a concept of computer science. Regular expressions are usually used to retrieve and replace text that conforms to a certain pattern (rule).

Many programming languages support string manipulation using regular expressions. Perl, for example, has a powerful regular expression engine built in. The concept of regular expression was first popularized by Unix tools such as sed and grep. Regular expressions are usually abbreviated as "regex", regexp and regex are singular, and regxps, regexes and regxen are plural.