To get the first 20 characters from a string of text without chopping off the last word, try this simple RegEx:/.{0,20} /i