和元宝共同成长的日子


  • 首页

  • 标签

  • 归档

正则表达式贪婪模式与非贪婪模式

发表于 2018-01-09

什么是正则表达式的贪婪模式和非贪婪模式?

我们先从例子入手:

1
2
var str = 'a "witch" and her "boom" is one';
str.match(/".*"/g);

原本想要匹配的字符为"witch"和"broom"两个字符串,运行以上的例子看看运行结果:

发现匹配的是"witch" and her "broom"这个字符串,之所以出现这个结果,是因为正则表达式的贪婪模式在起作用。

查找算法

我们假设自己是正则引擎,模拟一下搜索实现的过程。
正则引擎先从字符串的第0位开始搜索。

阅读全文 »

计算机是如何存储数据的

发表于 2018-01-07

计算机:二进制的世界

1110 0100 1011 1101 1010 0000 1110 0101 1010 0101 1011 1101
上面一行字就是“你好”在计算机中的表示方式

下面就来聊一聊计算机存储的过程

第一步:内存如何存储 0 和 1 ?

阅读全文 »

第二篇博客

发表于 2018-01-03

第二篇测试博客

这是二级标题

1
<p>代码字段</p>

开博大吉

发表于 2018-01-03

测试博客,是否能正常显示

Hello World

发表于 2018-01-03

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

12

左冬

Trust the process

15 日志
8 标签
© 2018 左冬
由 Hexo 强力驱动
|
主题 — NexT.Mist v5.1.4