Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var x = "mmmm lll"kkkkjjj/iiii,hhhh:gggg+ffff-eee+dddd;cccc|bbbb:aaaa";
- var separators = [' ', '\+', '-', ';', '"', '\|','//', '\|', '\(', '\)', '\*', '/', ':', '\?'];
- console.log(separators.join('|'));
- var tokens = x.split(new RegExp(separators.join('|'), 'g'));
- console.log(tokens);
- |+|-|;|"|||//|||(|)|*|/|:|?
- [ 'mmmm@gmail.com',
- 'lll@gmail.com',
- 'gggg@gmail.com',
- 'ffff@gmail.com',
- 'eee@gmail.com',
- 'dddd@gmail.com',
- 'cccc@gmail.com',
- 'bbbb@gmail.com',
- 'aaaa@gmail.com' ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement