I am trying to parse a string into:
- Remove initial "lunch" word
- Split the rest into days of week and their associated food item
The input comes in just as a string in this format:
var s = 'lunch monday: chicken and waffles, tuesday: mac and cheese, wednesday: salad';
And my goal is to split into:
[monday, chicken and waffles, tuesday, mac and cheese, wednesday, salad]
I am using s = s.split(' ').splice(1, s.length-1).join(' ').split(':');
Which gets me:
["monday", " chicken and waffles, tuesday", " mac and cheese, wednesday", " salad"]
Obviously it's splitting on the :
only, keeping the ,
there. I've tried using regex split(":|\\,");
to split on :
OR ,
but this does not work.
Any thoughts?