That was painful but figured it out.
Must be better ways but this works where lastWord will be the exact SMS message sent.
log(receivedMsg); // Display the received message
receivedMsg.trim(); // Remove any trailing or leading whitespace, including newlines
// Find the last newline character or any other delimiter expected)
int lastNewlineIndex = receivedMsg.lastIndexOf('"');
// Extract the substring after the last newline character
String lastWord = receivedMsg.substring(lastNewlineIndex + 1);
lastWord.replace("\n", "");
lastWord.replace("OK", "");
lastWord.replace("\r", ""); // Removes all carriage return characters