JavaScript 正则表达式迷你书 老姚 - v1.11.1. 两种模糊匹配 如果正则只有精确匹配是没多大意义的,比如 /hello/,也只能匹配字符串中的 "hello" 这个子串。 var regex = /hello/; console.log( regex.test("hello") ); // => true 正则表达式之所以强大,是因为其能实现模糊匹配。 而模糊匹配,有两个方向上的“模糊”:横向模糊和纵向模糊。 1.1.1. 横向模糊匹配 页 测试如下: var regex = /ab{2,5}c/g; var string = "abc abbc abbbc abbbbc abbbbbc abbbbbbc"; console.log( string.match(regex) ); // => ["abbc", "abbbc", "abbbbc", "abbbbbc"] NOTE 案例中用的正则是 /ab{2,5}c/g,其中 "a1b"、"a2b"、"a3b"。 其可视化形式如下: 测试如下: var regex = /a[123]b/g; var string = "a0b a1b a2b a3b a4b"; console.log( string.match(regex) ); // => ["a1b", "a2b", "a3b"] 以上就是本章讲的主体内容,只要掌握横向和纵向模糊匹配,就能解决很大部分正则匹配问题。 接下来,我们将具体展开来说。0 码力 | 89 页 | 3.42 MB | 11 月前3
JavaScript 正则表达式迷你书 老姚 - v1.01.1. 两种模糊匹配 如果正则只有精确匹配是没多大意义的,比如 /hello/,也只能匹配字符串中的 "hello" 这个子串。 var regex = /hello/; console.log( regex.test("hello") ); // => true 正则表达式之所以强大,是因为其能实现模糊匹配。 而模糊匹配,有两个方向上的“模糊”:横向模糊和纵向模糊。 1.1.1. 横向模糊匹配 页 测试如下: var regex = /ab{2,5}c/g; var string = "abc abbc abbbc abbbbc abbbbbc abbbbbbc"; console.log( string.match(regex) ); // => ["abbc", "abbbc", "abbbbc", "abbbbbc"] NOTE 案例中用的正则是 /ab{2,5}c/g,其中 "a1b"、"a2b"、"a3b"。 其可视化形式如下: 测试如下: var regex = /a[123]b/g; var string = "a0b a1b a2b a3b a4b"; console.log( string.match(regex) ); // => ["a1b", "a2b", "a3b"] 以上就是本章讲的主体内容,只要掌握横向和纵向模糊匹配,就能解决很大部分正则匹配问题。 接下来,我们将具体展开来说。0 码力 | 89 页 | 3.42 MB | 11 月前3
TiDB v8.3 DocumentationTiDB cluster status· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 690 5.5.2 Log in to the database and perform simple operations· · · · · · · · · · · · · · · 693 5.6 Test Cluster Encryption for Disk Spill · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 873 8.1.7 Log Redaction · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · a disaster in the upstream cluster · · · · · · · · · · · · · · · · · 1151 8.13.5 Step 5. Use redo log to ensure data consistency · · · · · · · · · · · · · · · · · · · · 1151 8.13.6 Step 6. Recover the0 码力 | 6606 页 | 109.48 MB | 10 月前3
TiDB v8.2 DocumentationTiDB cluster status· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 687 5.5.2 Log in to the database and perform simple operations· · · · · · · · · · · · · · · 690 5.6 Test Cluster Encryption for Disk Spill · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 870 8.1.7 Log Redaction · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · a disaster in the upstream cluster · · · · · · · · · · · · · · · · · 1146 8.13.5 Step 5. Use redo log to ensure data consistency · · · · · · · · · · · · · · · · · · · · 1146 8.13.6 Step 6. Recover the0 码力 | 6549 页 | 108.77 MB | 10 月前3
TiDB v8.5 DocumentationTiDB cluster status· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 770 5.6.2 Log in to the database and perform simple operations· · · · · · · · · · · · · · · 773 5.7 Test Cluster · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 960 7.3.4 Changefeed Log Filters · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 968 7.3 Encryption for Disk Spill · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 1247 8.1.7 Log Redaction · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·0 码力 | 6730 页 | 111.36 MB | 10 月前3
TiDB v8.4 DocumentationTiDB cluster status· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 765 5.5.2 Log in to the database and perform simple operations· · · · · · · · · · · · · · · 768 5.6 Test Cluster Encryption for Disk Spill · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 948 8.1.7 Log Redaction · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · a disaster in the upstream cluster · · · · · · · · · · · · · · · · · 1237 8.13.5 Step 5. Use redo log to ensure data consistency · · · · · · · · · · · · · · · · · · · · 1237 8.13.6 Step 6. Recover the0 码力 | 6705 页 | 110.86 MB | 10 月前3
TiDB v8.1 DocumentationTiDB cluster status· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 685 5.5.2 Log in to the database and perform simple operations· · · · · · · · · · · · · · · 688 5.6 Test Cluster Encryption for Disk Spill · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 868 8.1.7 Log Redaction · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · a disaster in the upstream cluster · · · · · · · · · · · · · · · · · 1143 8.13.5 Step 5. Use redo log to ensure data consistency · · · · · · · · · · · · · · · · · · · · 1143 8.13.6 Step 6. Recover the0 码力 | 6479 页 | 108.61 MB | 10 月前3
阮一峰 JavaScript 教程行。建议阅读本教程时,将代码复制到控制台进行实验。 作为尝试,你可以将下面的程序复制到“控制台”,按下回车后,就可以 看到运行结果。 1. function greetMe(yourName) { 2. console.log('Hello ' + yourName); 3. } 4. 5. greetMe('World') 6. // Hello World 导论 - 17 - 本文档使用 书栈(BookStack ng)。 1. console.log(a); 2. var a = 1; 上面代码首先使用 console.log 方法,在控制台(console)显示变 量 a 的值。这时变量 a 还没有声明和赋值,所以这是一种错误的做 法,但是实际上不会报错。因为存在变量提升,真正运行的是下面的代 码。 1. var a; 2. console.log(a); 3. a = 1; 变量提升 function countdown(n) { 注释 基本语法 - 38 - 本文档使用 书栈(BookStack.CN) 构建 2. while (n --> 0) console.log(n); 3. } 4. countdown(3) 5. // 2 6. // 1 7. // 0 上面代码中, n --> 0 实际上会当作 n-- > 0 ,因此输出2、1、0。0 码力 | 540 页 | 3.32 MB | 10 月前3
Mix Assertion, Logging, Unit Testing and Fuzzing with ZeroErrstd::unique_ptrClass from third-party library: llvm::Value*Logging the Data // LOG(INFO) << Data; // ASSERT(a > b, “A > B is not true”, a, b); std::ostream& operator<<(std::ostream& implement with template • No extensibility • No customization for different scenario for the same type LOG("Input is: {}", input); A better way is using a formatting-like interface, and a stateful functor: testing also need pretty printing, e.g.: ASSERT(a != 0, "a should not be 0. Input is: {}", input); LOG("Input is: {}", input); Logging macro:Do I catch the bug? Yes, and it’s inside a unit test case. 0 码力 | 54 页 | 961.46 KB | 6 月前3
廖雪峰JavaScript教程Tools)”,浏览器窗口就会一分为二,下方就是开发者工具: 先点击“控制台(Console)“,在这个面板里可以直接输入JavaScript代码,按回车后执行。 要查看一个变量的内容,在Console中输入 console.log(a); ,回车后显示的值就是变量的内容。 调试 2 快速入门 - 11 - 本文档使用 书栈(BookStack.CN) 构建 关闭Console请点击右上角的“×”按钮。请熟练掌握Con 级调试技巧。 打开新浪首页,然后查看页面源代码,找一找引入的JavaScript文件和直接编写在页面中的 JavaScript代码。然后在Chrome中打开开发者工具,在控制台输入 console.log('Hello'); ,回 车查看JavaScript代码执行结果。 原文: https://wizardforcel.gitbooks.io/liaoxuefeng/content/js/3.html alert('adult'); 4. else 5. console.log('age < 18'); // 添加一行日志 6. alert('teenager'); // <- 这行语句已经不在else的控制范围了 上述代码的 else 子句实际上只负责执行 console.log('age < 18'); ,原有 的 alert('teenager');0 码力 | 264 页 | 2.81 MB | 10 月前3
共 231 条
- 1
- 2
- 3
- 4
- 5
- 6
- 24













