<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
</body>
<script>
let isNum = /^\d*$/g // 校验是否为数字,
let stringData = '123'
// regex.test(String)
console.log("TCL: isNum.test(stringData)", isNum.test(stringData)) // true or false
// String.match(regex)
console.log("TCL: stringData.match(isNum)", stringData.match(isNum)) // 数组 or null
// String.replace(regex,'*')
console.log("TCL: stringData.replace(isNum,'*')", stringData.replace(isNum, '*')) // *
var str = 'abc/de/f'
var regex = /[/]/g
str.replace(regex, '-')
console.log("TCL: str.replace(regex, '-')", str.replace(regex, '-')) // abc-de-f
</script>
</html>