I am looking for something very similar to this, only that I want all matches and not just the first one. In javascript, you can add a 'global' modifier in order to get a list of all matches, is something similar possible in java?
Asked
Active
Viewed 75 times
0
-
Since you do not provide a sample regex and input, it is unsure what you ask; anyway, note that a `Matcher` can match more than once; so, if you have instantiated a `Matcher`, you can do `while (m.find()) /* do something */` – fge Oct 25 '14 at 19:52
1 Answers
1
Yes, use while
instead of an if
statement to iterate through the match results.
while (m.find()) {
...
}

hwnd
- 69,796
- 4
- 95
- 132