I think this is very easy but I can't figure it out.
var str = "How are you doing today?";
var res = str.split(/\s+/g);
And the result would be: How,are,you,doing,today?
. When user add character "|" between two words like this
var str = "How are you |doing today?";
The result shoul be: How,are,you doing,today?