I have a regex which looks like this:
[@|#](.*?)\s
What I basically want is, split matching regex into arrays.
So I use the following code:
var testString = "Hi this is a test @info@test.com and @martin we have to go."
console.log(testString.split(/(\@|\#)(.*?)\s/));
The result what I get looks like this:
["Hi this is a test ", "@", "info@test.com", "and ", "@", "martin", "we have to go."]
What I actually want is:
["Hi this is a test ", "@info@test.com", "and ", "@martin", "we have to go."]