Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const text = 'First note\n \n---\nSecond note\n \n---\nThird note';
- const notes = text
- .replace('/\n( +)\n/gm','\n\n')
- .split('\n\n---\n')
- .map(n => n.trim())
- .filter(n => n);
- console.log(notes);
Add Comment
Please, Sign In to add comment