Hello,
It exists in the Java API, for example, a scanner class
I was wondering if it would not be possible in the given example, modify the regular expression by putting "(sth fruit) *" since the word acts a the delimiter. Do you have any idea of how to do it. Thanks in advance.Code:String input = "1 fruit 2 fruit red fruit blue fruit"; Scanner s = new Scanner(input); s.findInLine("(\\d +) fruit (\\d +) fruit (\\w +) fruit (\\w +) "); MatchResult rs = s.Match(); for (int i =1; I <= rs.GroupCount(); I + +) System.out.System.out.println(rs.group(i); s.close();
Bookmarks