Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- public class practice {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String regex = "([0-9]+)";
- String example = "99999";
- Pattern pattern = Pattern.compile(regex);
- Matcher matcher = pattern.matcher(example);
- String tiPrint = matcher.group(0);
- System.out.printf("%s",tiPrint);
- }
- }
- Exception in thread "main" java.lang.IllegalStateException: No match found
- at java.base/java.util.regex.Matcher.group(Matcher.java:645)
- at practice.main(practice.java:14)
- Process finished with exit code 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement