How would I parse a file like this:
Item costs $15 and is made up of --Metal--
Item costs $64 and is made up of --Plastic--
I can do
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(input);
String result = m.group();
But how would I get EVERY result?
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(input);
List<String> matches = new ArrayList<String>();
while(m.find()){
matches.add(m.group());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With