JAVA regular expression method to check qq number

Java Regular Expression

Regular expressions define patterns for strings.
Regular expressions can be used to search, edit or process text.
Regular expressions are not limited to one language, but there are subtle differences in each language.

Regular Expression Example

A string is actually a simple regular expression, for example the Hello World regular expression matches the "Hello World" string.

. (dot) is also a regular expression that matches any character such as: "a" or "1".

The following table lists some examples and descriptions of regular expressions :

 

regular expression describe

this is text

matches the string "this is text"

this\s+is\s+text

Note the \s+ in the string.

Matches \s+ after the word "this" to match multiple spaces, followed by the is string, followed by \s+ followed by multiple spaces followed by the text string.

Can match this instance: this is text

^\d+(\.\d+)?

^ defines what to start with

\d+ matches one or more digits

? Setting options in parentheses are optional

\. matches "."

Examples that can be matched: "5", "1.5" and "2.21".

 

/*
* Check the qq number Anhui
Surrogacy Company * It must be 5-15 digits
* 0 cannot start
* must be all numbers
*/

(1) Use regular expressions to check qq numbers

(2) Method 2

Summarize

The above is the method of JAVA regular expression checking QQ number introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325234388&siteId=291194637