File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
src/main/java/com/shy/day14 Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .shy .day14 ;
2
+
3
+ import java .util .regex .Matcher ;
4
+ import java .util .regex .Pattern ;
5
+
6
+ /**
7
+ * @ClassName test1
8
+ * @Author shy
9
+ * @Date 2020/11/2
10
+ **/
11
+ public class test1 {
12
+ public static void main (String [] args ) {
13
+ String check = "^([a-z0-9A-Z]+[-|\\ .]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\ .)+[a-zA-Z]{2,}$" ;
14
+ Pattern regex = Pattern .compile (check );
15
+ Matcher matcher = regex .matcher ("2437309168@qq.1cn" );
16
+ boolean isMatched = matcher .matches ();
17
+ System .out .println (isMatched );
18
+
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ package com .shy .day14 ;
2
+
3
+ import java .util .regex .Matcher ;
4
+ import java .util .regex .Pattern ;
5
+
6
+ /**
7
+ * @ClassName test2
8
+ * @Author shy
9
+ * @Date 2020/11/2
10
+ **/
11
+ public class test2 {
12
+ public static void main (String [] args ) {
13
+ String check = "^((13[0-9])|(15[^4,\\ D])|(18[0,5-9]))\\ d{8}$" ;
14
+ Pattern regex = Pattern .compile (check );
15
+ Matcher matcher = regex .matcher ("03174154204" );
16
+ System .out .println (matcher .matches ());
17
+ }
18
+ }
You can’t perform that action at this time.
0 commit comments