-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added test cases related to classes pattern and matcher
Signed-off-by: Lucas Cordeiro <[email protected]>
- Loading branch information
1 parent
0cccfe3
commit be02a80
Showing
6 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
public class RegexMatches01 | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
Pattern expression = | ||
Pattern.compile("W.*\\d[0-35-9]-\\d\\d-\\d\\d"); | ||
|
||
String string1 = "XXXX's Birthday is 05-12-75\n" + | ||
"YYYY's Birthday is 11-04-68\n" + | ||
"ZZZZ's Birthday is 04-28-73\n" + | ||
"WWWW's Birthday is 12-17-77"; | ||
|
||
Matcher matcher = expression.matcher(string1); | ||
|
||
while (matcher.find()) | ||
{ | ||
System.out.println(matcher.group()); | ||
String tmp=matcher.group(); | ||
assert tmp.equals("WWWW's Birthday is 12-17-77"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FUTURE | ||
RegexMatches01.class | ||
--string-refine --unwind 100 | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
public class RegexMatches02 | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
Pattern expression = | ||
Pattern.compile("W.*\\d[0-35-9]-\\d\\d-\\d\\d"); | ||
|
||
String string1 = "XXXX's Birthday is 05-12-75\n" + | ||
"YYYY's Birthday is 11-04-68\n" + | ||
"ZZZZ's Birthday is 04-28-73\n" + | ||
"WWWW's Birthday is 12-17-77"; | ||
|
||
Matcher matcher = expression.matcher(string1); | ||
|
||
while (matcher.find()) | ||
{ | ||
System.out.println(matcher.group()); | ||
String tmp=matcher.group(); | ||
assert tmp.equals("WWWWW's Birthday is 12-17-77"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FUTURE | ||
RegexMatches02.class | ||
--string-refine --unwind 100 | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |