Added checking to see if the text is just a string of spaces with /\s*/