1、备选字符集
[] 里的内容也是或的关系
[abc] a或b或c
[0-9] 数字0-9
[a-z] 字符a-b
[A-Z] 字符A-Z
var str = 'desdjl932j388Tm'
var reg = /[0-9]/g
console.log(str.replace(reg,"*"));//desdjl***j***Tm
console.log(str.replace(/[A-z]/g,"*"));//******932*388**
2、预定义字符集
\b [0-9]
\w [0-9A-z_]
\s 空格
. 表示所有的字符
var str = "35453adasdfa"
var reg = /\d/g
console.log(str.replace(reg,"*"));//*****adasdfa
var a = "hello_world1234WS"
console.log(a.replace(/\w/g,"*"));//*******************
console.log(a.replace(/./g,"*"));//****************
var a = "hello.world"
var reg = /\./
console.log(a.replace(reg,"*"));//hello*world