正则为:/[^a-z|A-Z|0-9|\-|_|\.]/g
<script> var name = "hjhj测试[[[[[{{{{as9-._>@##$$?W??"; var regs = /[^a-z|A-Z|0-9|\-|_|\.]/g; name= name.replace(regs, ""); console.log("name:",name); </script>输出结果是: hjhjas9-._W
正则为:/[^a-z|A-Z|0-9|\-|_|\.]/g
<script> var name = "hjhj测试[[[[[{{{{as9-._>@##$$?W??"; var regs = /[^a-z|A-Z|0-9|\-|_|\.]/g; name= name.replace(regs, ""); console.log("name:",name); </script>输出结果是: hjhjas9-._W