【发布时间】:2019-01-05 01:02:34
【问题描述】:
如何在 JavaScript 中使用 replace regex 去除句子中不是字母、数字或空格的所有内容?
var string = "here is a sentence with letters and numbers and symbols 123!@#";
【问题讨论】:
标签: javascript regex
如何在 JavaScript 中使用 replace regex 去除句子中不是字母、数字或空格的所有内容?
var string = "here is a sentence with letters and numbers and symbols 123!@#";
【问题讨论】:
标签: javascript regex
var string = "here is a sentence with letters and numbers and symbols 123!@#";
var x = string.replace(/[^a-zA-Z0-9 ]/g,'')
console.log(x)
【讨论】: