2019 10 17
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> </title>
<script src="jquery-1.12.2.js"></script>
<script>
var str = '2019-12-14';
var reg = /(\d{4})-(\d{1,2})-(\d{1,2})/;
if (reg.test(str)) {
console.log(RegExp.$1);
}
var str1 = '2274818933@qq.com.cn';
var reg1 = /(\w+)@(\w+)\.(\w+)(\.\w+)?/;
if (reg1.test(str1)) {
console.log(RegExp.$1);
console.log(RegExp.$2);
console.log(RegExp.$3);
console.log(RegExp.$4);
}
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> </title>
</head>
<body>
<script>
var str = '2019-12/12';
console.log(str.split(/[-/]/));
var str1 = '2274818933@qq.com';
console.log(str1.split(/[@\.]/));
var str2 = '123456789';
var str3 = str2.replace(/\d/g,'a')
console.log(str3)
</script>
</body>
</html>