JSFiddle - React, Tailwind, and code Playground

JavaScript

var testString = "Hi this is a test @info@test.com and @martin we have to go."
console.log(testString.split(/(\@|\#)(.*?)\s/));

var testString2= "Look at #ean-4456 is not valid, please verify #ean-2245 to do this."
console.log(testString2.split(/(\@|\#)(.*?)\s/));