I was trying to split a string based on multiple delimiters by referring How split a string in jquery with multiple strings as separator
Since multiple delimiters I decided to follow
var separators = [' ', '+', '-', '(', ')', '*', '/', ':', '?'];
var tokens = x.split(new RegExp(separators.join('|'), 'g'));
But I'm getting error
Uncaught SyntaxError: Invalid regular expression: / |+|-|(|)|*|/|:|?/: Nothing to repeat
How to solve it?