var data='是大概率是的结果速度过来的感觉,的感觉了多少个给大家'; data = data.slice(0, 30) .replace(/(\s)*([a-zA-Z0-9]+|\W)(\.\.\.)?$/, '...');