Like many others, I'm crap at regex and particularly bad when it comes to regex in javascript.
I have a string that can take two formats:
var str = "This is a string t:1h"
or
var str = "This is a string t:1h,2h,3h"
I would like to match the 't:X' part or 't:X,X,X' part (whichever it happens to be) from the string and handle that separately.
Can anybody clever show me how to do a regex match on this string for this?
I haven't gotten very far. I have:
var reg = /\s?/m;
parsed = str.match(reg);
Please help.