Been trying to come up with a regex in JS that could split user input like :
"Hi{user,10,default} {foo,10,bar} Hello"
into:
["Hi","{user,10,default} ","{foo,10,bar} ","Hello"]
So far i achieved to split these strings with ({.+?,(?:.+?){2}})|([\w\d\s]+)
but the second capturing group is too exclusive, as I want every character to be matched in this group. Tried (.+?)
but of course it fails...
Ideas fellow regex gurus?