I am trying to match a pattern of numbers/words and then split on that grouping into an array. I have a regex pattern that seems to identify things properly (for the most part). Using RegExr.com I have made this:
It is ALMOST Correct. I cannot see why it will not get the word "crumbs" in bread crumbs.
I want to split on each ingredient and then push each one into an index in an array.
I have tried:
var regExp = '/(\d+)([^\d]+) |(\d+\/\d+) [^\d]+ /g'; cleanedText = ingredients.split(regExp); console.log(cleanedText);
This does not work. It's not splitting at all. It's looking for [number space words] | [or Fraction space Words] and should split on each one it finds.