I have a string and a matching pattern like this :
var string = 'stackoverflow Javascript Regex Help';
var pattern=/(^stackoverflow Javascript)/;
I'm looking for a way to reuse my previous pattern without having to rewrite it again. Shortly, I want to add an additional option at the end of my previous pattern (matching a space before splitting)
var newString=string.split(pattern+/(.\S*)/);
alert(newString); //Regex Help
But this doesn't work. Is there a way I can accomplish this ?
Thank you for your hep.