KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The code String s = "y z a a a b c c z"; Pattern p = Pattern.compile("(a )+(b )+(c *)c"); Matcher m = p.matcher(s); while (m.find()) { System.out.println(m.group()); } prints a a a b c c which is right. But logically, the substrings a a a b c a a b c c a a b c a b c c a b c match the regex too. So, how can I make the code find those substrings too, i.e. not only the most extended one, but also its children ?
Tags (comma-separated)
Save Edits
Cancel