while loop to extract regex matches in a sentence