I have a string format inside of a string variable:
\"{0} Hello World {1}\"
I need to split it into something like this:
\"{0}\
You can use the following:
\s*({\d+})\s*
JS Code:
var regex = /\s*({\d+})\s*/g; var split_string = "{0} Hello World {1}".split(regex).filter(Boolean); alert(split_string);