Java regular expressions
Regular expressions define the pattern of strings.
Regular expressions can be used to search, edit, or process text.
Regular expressions are not limited to a certain language, but there are slight differences in each language.
Regular expression instance
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 expressions | describe |
|---|---|
This is text | Match the string "this is text" |
this/s+is/s+text | Note /s+ in the string. The /s+ after the word "this" can match multiple spaces, then match the is string, then /s+ match multiple spaces and then follow the text string. This instance can be matched: this is text |
^/d+(/./d+)? | ^ Define what to start with /d+ matches one or more numbers ? Set the options in brackets are optional /. Match "." Examples that can be matched: "5", "1.5" and "2.21". |
/*
* Check the QQ number
* The requirement must be 5-15 digits
* 0 cannot start
* Must be all numbers
*/
(1) Use regular expression to verify the qq number
(2) Method 2
Summarize
The above is the method of verifying the qq number by the JAVA regular expression that the editor introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!