Having problems with regular expressions in JavaScript. I've got a number of strings that need delimiting by commas. Unfortunately the sub strings don't have quotes around them which would make life easier.
var str1 = "Three Blind Mice 13 Agents of Cheese Super 18"
var str2 = "An Old Woman Who Lived in a Shoe 7 Pixies None 12"
var str3 = "The Cow Jumped Over The Moon 21 Crazy Cow Tales Wonderful 9"
They are in the form of PHRASE1 (Mixed type with spaces") INTEGER1 (1 or two digit) PHRASE2 (Mixed type with spaces") WORD1 (single word mixed type, no spaces) INTEGER2 (1 or two digit)
so I should get:
result1 = "Three Blind Mice, 13, Agents of Cheese, Super, 18"
result2 = "An Old Woman Who Lived in a Shoe, 7, Pixies, None, 12"
result3 = "A Cow Jumped Over The Moon, 21, Crazy Cow Tales, Wonderful, 9"
I've looked at txt2re.com, but can't quite get what I need and ended up delimiting by hand. But I'm sure it can be done, albeit someone with a bigger brain. There are lots of examples of regEx but I couldn't find any to deal with phrases; so I was wondering if anyone could help me out. Thank you.