I would expect this line of JavaScript:
\"foo bar baz\".match(/^(\\s*\\w+)+$/)
to return something like:
[\"foo bar baz\",
Unless you have a more complicated requirement for how you're splitting your strings, you can split them, and then return the initial string with them:
var data = "foo bar baz"; var pieces = data.split(' '); pieces.unshift(data);