|
|
@@ -0,0 +1,29 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="en">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>Document</title>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <script>
|
|
|
+ const reg = /(ab)(cc)/;
|
|
|
+ console.log(reg.test('ababaccb'));
|
|
|
+ console.log(reg.test('abab'));
|
|
|
+ console.log(reg.test('abccab'));
|
|
|
+ console.log(reg.test('ababaccb'));
|
|
|
+
|
|
|
+ const data = '2026-01-30';
|
|
|
+ const reg1 = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
|
+ console.log(reg1.test(data));
|
|
|
+ console.log(data.replace(reg1,'$2/$3/$1'));
|
|
|
+
|
|
|
+
|
|
|
+ const reg2 = /西游记|红楼梦/;
|
|
|
+ console.log(reg2.test("红楼梦"));
|
|
|
+ console.log(reg2.test("水浒传"));
|
|
|
+ // /^\d{15,17}$/
|
|
|
+ // https://regexper.com/ 网址
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|