I have string of ingredients of a product like this:
text = 'Pork and beef, water, salt (1,7%), spices (white pepper, nutmeg, coriander, cardamom), stabilizer (E450), glucose, antioxidant (E316), a preservative (E250), flavorings'
I want to detect all the text (ingredients) from it such that it should look like this.
ingredientsList= ['Pork and beef', 'salt', 'spices', 'white pepper', 'nutmeg', 'coriander', 'cardamom', 'stabilizer', 'glucose', 'antioxidant', 'preservative', 'flavorings']
The current regex I am using here is the following:
ingredients = re.findall(r'\([^()]*\)|([^\W\d]+(?:\s+[^\W\d]+)*)', text)
But it is not providing the the text in the bracket. I just did not want to include codes and percentages but want all the ingredients inside the brackets. What should I do here ? Thanks in advance.