1 2 3 4 5 6 7 8 9 |
List<String> getMatchers(String regex, String source){ Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(source); List<String> list = new ArrayList<>(); while (matcher.find()) { list.add(matcher.group()); } return list; } |
from:https://blog.csdn.net/w305172521/article/details/75330661