I fetch some html and do some string manipulation and en up with a string like
string sample = "\n \n 2 \n \n \ndl. \n \n \n flour\n\n \n 4 \n \n cups of \n\nsugar\n"
I would like to find all ingredient lines and remove whitespaces and linebreaks
2 dl. flour and 4 cups of sugar
My approach so far is to the following.
Pattern p = Pattern.compile("[\\d]+[\\s\\w\\.]+");
Matcher m = p.matcher(Result);
while(m.find()) {
// This is where i need help to remove those pesky whitespaces
}