我应该如何解析这样的文件: Item costs $15 and is made up of --Metal-- Item costs $64 and is made up of --Plastic-- 我能做到。Pattern p = Pattern.compile(regex); Matcher m = p.matcher(input); String result = m.group(); 但是如何获得每一个结果?
Pattern p = Pattern.compile(regex); Matcher m = p.matcher(input); List<String> matches = new ArrayList<String>(); while(m.find()){ matches.add(m.group()); }