I would like to split a string of text into an array of sentences without loosing the punctuation mark.
var string = 'This is the first sentence. This is another sentence! This is a question?'
var splitString = string.split(/[!?.] /);
splitString
=> ["This is the first sentence", "This is another sentence", "This is a question?"]
Only the last punctuation mark(?) is kept. What is the best way to split after the punctuation marks on all the sentences so that splitString returns the following instead?
["This is the first sentence.", "This is another sentence!", "This is a question?"]