当前位置:网站首页>regular expression
regular expression
2022-07-04 06:29:00 【Envy the cloud rather than the king】
stay java In a /: Represents the translation character , So we need two // It means a /.


Code :
public class Matching basis {
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "abc";
System.out.println(str.matches("abc"));
}
}
Code :
public class Matching basis {
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "a&c";
System.out.println(str.matches("a\\&c"));
}
} 
Code :
public class Matching basis {
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "a and c";
System.out.println(str.matches("a\\u548cc"));
}
}
Code :
public class Matching basis {
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "a and c";// and : Right and wrong ASCALL character
System.out.println(str.matches("a.c"));
String str1 = "a.c";//.: It's a special character
System.out.println(str1.matches("a.c"));// there . Represents matching any character
System.out.println(str1.matches("a\\.c"));// Here is the match . This special character : Special character matching requires translation
}
} 

\d*: Indicates that any number can be matched
Be careful :System.out.println(str1.matches("*")); This is incorrect
System.out.println(str1.matches("+")); This is incorrect
however
System.out.println(str1.matches(".")); It's the right way to use it : The table matches any character

\d+: Indicates that at least one number is matched 
\d?: Represents a match 0 Or 1 A digital



matching a-f perhaps 0-9 In between 6 Characters
Can match a To f perhaps 0 To 9 perhaps _ Medium 6 Characters 



边栏推荐
- Internet of things protocol ZigBee ZigBee module uses the concept of protocol stack
- C language - Blue Bridge Cup - Snake filling
- 【无标题】
- 手动对list进行分页(参数list ,当前页,页面大小)
- How to realize multi account login of video platform members
- uniapp 自定义环境变量
- Nexus 6p从8.0降级6.0+root
- 17-18. Dependency scope and life cycle plug-ins
- High performance parallel programming and optimization | lesson 02 homework at home
- How to implement cross domain requests
猜你喜欢

实用的小工具指令

746. Climb stairs with minimum cost

LayoutManager布局管理器:FlowLayout、BorderLayout、GridLayout、GridBagLayout、CardLayout、BoxLayout

Learn about the Internet of things protocol WiFi ZigBee Bluetooth, etc. --- WiFi and WiFi protocols start from WiFi. What do we need to know about WiFi protocol itself?

High performance parallel programming and optimization | lesson 02 homework at home

Win10 clear quick access - leave no trace

Overview of convolutional neural network structure optimization

Error CVC complex type 2.4. a: Invalid content beginning with element 'base extension' was found. Should start with one of '{layoutlib}'.

Practical gadget instructions

Sleep quality today 78 points
随机推荐
Understanding of cross domain and how to solve cross domain problems
双色球案例
如何实现视频平台会员多账号登录
Common JS tool Libraries
手动对list进行分页(参数list ,当前页,页面大小)
分布式CAP理论
Distributed cap theory
LayoutManager布局管理器:FlowLayout、BorderLayout、GridLayout、GridBagLayout、CardLayout、BoxLayout
Learning multi-level structural information for small organ segmentation
Cloud native - SSH article that must be read on the cloud (commonly used for remote login to ECS)
How to realize multi account login of video platform members
JS execution mechanism
2022.7.2-----leetcode.871
Option (024) - do all objects have prototypes?
Sort list tool class, which can sort strings
Notes and notes
buuctf-pwn write-ups (8)
Uniapp custom environment variables
SQL join, left join, right join usage
QT QTableWidget 表格列置顶需求的思路和代码