Hey, working on a project, one of the parts allows users to add Meals and their ingredients.
What I have planned for the ingredient input is that users are allowed to enter input as follows:
"ingredientA, INGREDIENTB, iNGREDientC, ingredient D", respectively each ingredient should be split via comma and whitespace.
Regex I came up with:
"[a-zA-Z ]+([,][ ][a-zA-Z]+)*" (added screenshot from regex101)
However, I can not explain why matcher returns false in case of:
"oats, milk, banana, peanut butter"
Even though regex1 shows that all string is matched, even if " peanut" part is matched in a different group, shouldnt it still return true?