In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you an overview and simple use, the content is concise and easy to understand, can definitely brighten your eyes, through the detailed introduction of this article, I hope you can get something.
Overview and simple use of regular expressions
* A: regular expression
* is a single string used to describe or match a series of strings that conform to certain grammatical rules. It's actually a rule. Has its own special application.
* function: for example, a registered mailbox has a user name and password, and its length is generally limited. This limit is done by regular expressions.
* B: case demonstration
* demand: check the qq number.
* 1: must be 5-15 digits
* cannot start at 2:0
* 3: it must all be numeric
* a: non-regular expression implementation
* b: regular expression implementation
Case study:
Package com.heima.regex
Public class Demo1_Regex {
Public static void main (String [] args) {
System.out.println (checkQQ ("012345"))
System.out.println (checkQQ ("a1b345"))
System.out.println (checkQQ ("123456"))
System.out.println (checkQQ ("1234567890987654321"))
String regex = "[1-9]\\ d {4pm 14}"
System.out.println ("2553868" .vendor (regex))
System.out.println ("012345" .vendor (regex))
System.out.println ("2553868abc" .vendor (regex))
}
/ *
* demand: check the qq number.
* 1: must be 5-15 digits
* cannot start at 2:0
* 3: it must all be numeric
* verify qq
* 1. Specify the return value type boolean
* 2, clear parameter list String qq
, /
Public static boolean checkQQ (String qq) {
Boolean flag = true; / / set flag to false if the verification qq does not meet the requirements, and return directly if it meets the requirements
If (qq.length ()) > = 5 & & qq.length () ='0' & & ch
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 208
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.