In JavaScript, how would I get ['John Smith', 'Jane Doe'] from "John Smith - Jane Doe" where - can be any separator (\ / , + * : ;) and so on, using regex ?
Using new RegExp('[a-zA-Z]+[^\/|\-|\*|\+]', 'g') will just give me ["John ", "Smith ", "Jane ", "Doe"]
In JavaScript, how would I get [‘John Smith’, ‘Jane Doe’] from John Smith –
Share
Try this, no regex:
Edit
Multiple separators: