In Java, I am trying to return all regex matches to an array but it seems that you can only check whether the pattern matches something or not (boolean).
How can I u
In Java 9, you can now use Matcher#results() to get a Stream
import java.util.regex.Pattern;
import java.util.regex.MatchResult;
String[] matches = Pattern.compile("your regex here")
.matcher("string to search from here")
.results()
.map(MatchResult::group)
.toArray(String[]::new);
// or .collect(Collectors.toList())