亲们,一段中英文混着的字符串,想保留英文空格和标点,去掉中文空格保留标点,正则咋写。。
例如:“Never put off the work till tomorrow what you can put off today.不要 等 明天 交不上 差再找借口, 今天 就要找好。”;
替换成“Never put off the work till tomorrow what you can put off today.不要等明天交不上差再找借口,今天就要找好。”
亲们,一段中英文混着的字符串,想保留英文空格和标点,去掉中文空格保留标点,正则咋写。。 例如:“Never put off the work till tomorrow what you can put off today.不要 等 明天 交不上 差再找借口, 今天 就要找好。”; 替换成“Never put off the work till tomorrow what you can put off today.不要等明天交不上差再找借口,今天就要找好。”
var str = "Never put off the work till tomorrow what you can put off today.不要 等 明天 交不上 差再找借口, 今天 就要找好。";
alert(str.replace(/[ ]+(?=[\u4e00-\u9fa5])/g,""));