Skip to content

Commit be02a80

Browse files
 added test cases related to classes pattern and matcher
Signed-off-by: Lucas Cordeiro <[email protected]>
1 parent 0cccfe3 commit be02a80

File tree

6 files changed

+66
-0
lines changed

6 files changed

+66
-0
lines changed
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FUTURE
2+
RegexMatches01.class
3+
--string-refine --unwind 100
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FUTURE
2+
RegexMatches02.class
3+
--string-refine --unwind 100
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
^warning: ignoring

0 commit comments

Comments
 (0)