If I have a word like "blue..." or "sky!!" or "r;e;d"
I want to save the punctuation characters at the end of each word. So if I inputted blue... into a function, it would return ... If I inputted sky!! into the same function, it would return !! Nothing should be returned if I input r;e;d because the punctuation characters are in the middle of the sentence.
So far my function looks like
string returnLastPunctuation(string word) {
string punct;
regex_match(word, punct, regex("[\\.?!]+$"));
return punct;
}
But the code won't even run, so how would I go about fixing it?