Replacing the first and last word with span tags