File tree Expand file tree Collapse file tree 6 files changed +66
-0
lines changed Expand file tree Collapse file tree 6 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ import java .util .regex .Matcher ;
2+ import java .util .regex .Pattern ;
3+
4+ public class RegexMatches01
5+ {
6+ public static void main (String [] args )
7+ {
8+ Pattern expression =
9+ Pattern .compile ("W.*\\ d[0-35-9]-\\ d\\ d-\\ d\\ d" );
10+
11+ String string1 = "XXXX's Birthday is 05-12-75\n " +
12+ "YYYY's Birthday is 11-04-68\n " +
13+ "ZZZZ's Birthday is 04-28-73\n " +
14+ "WWWW's Birthday is 12-17-77" ;
15+
16+ Matcher matcher = expression .matcher (string1 );
17+
18+ while (matcher .find ())
19+ {
20+ System .out .println (matcher .group ());
21+ String tmp =matcher .group ();
22+ assert tmp .equals ("WWWW's Birthday is 12-17-77" );
23+ }
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ FUTURE
2+ RegexMatches01.class
3+ --string-refine --unwind 100
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^VERIFICATION SUCCESSFUL$
7+ --
8+ ^warning: ignoring
Original file line number Diff line number Diff line change 1+ import java .util .regex .Matcher ;
2+ import java .util .regex .Pattern ;
3+
4+ public class RegexMatches02
5+ {
6+ public static void main (String [] args )
7+ {
8+ Pattern expression =
9+ Pattern .compile ("W.*\\ d[0-35-9]-\\ d\\ d-\\ d\\ d" );
10+
11+ String string1 = "XXXX's Birthday is 05-12-75\n " +
12+ "YYYY's Birthday is 11-04-68\n " +
13+ "ZZZZ's Birthday is 04-28-73\n " +
14+ "WWWW's Birthday is 12-17-77" ;
15+
16+ Matcher matcher = expression .matcher (string1 );
17+
18+ while (matcher .find ())
19+ {
20+ System .out .println (matcher .group ());
21+ String tmp =matcher .group ();
22+ assert tmp .equals ("WWWWW's Birthday is 12-17-77" );
23+ }
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ FUTURE
2+ RegexMatches02.class
3+ --string-refine --unwind 100
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^VERIFICATION FAILED$
7+ --
8+ ^warning: ignoring
You can’t perform that action at this time.
0 commit comments