惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
F
Full Disclosure
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threatpost
I
Intezer
V2EX - 技术
V2EX - 技术
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
小众软件
小众软件
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
N
News | PayPal Newsroom
MyScale Blog
MyScale Blog
AI
AI
Vercel News
Vercel News
Spread Privacy
Spread Privacy
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 热门话题
U
Unit 42
L
LangChain Blog
Recent Announcements
Recent Announcements

博客园 - 人工智能-群513704292

再出发 新的一年快开始了,学点新东西吧,从React开始(一) ECMAScript 6 Features 中文版 必须清零 彩印网的第一阶段即将收官 终于感觉掌握了一门重要的技术 程序员的命运之轮 2015年开局 2014年总结 终于理解了函数式技术 Swift来的正是时候 js的this和面向对象编程 js的this上下文的坑 JS正则表达式进阶 前端样板资源概览及总评 C#的前世今生,学会C#还能找到高薪工作吗? CSS基本知识6-CSS字体 CSS基本知识5-CSS对齐 CSS基本知识4-CSS行模型
JS正则表达式基本概念
人工智能-群513704292 · 2014-05-06 · via 博客园 - 人工智能-群513704292

1.正则表达式(Regular Expression) 在JS里是RegExp

两种字义方式

1. var patt1=new RegExp("e");

2. var patt1 = /e/;

RegExp 对象有 3 个方法:test()、exec() 以及 compile()。

例如 /\d/.test('123'); //true

/\w+/.exec('abc'); //abc

compile少见

string 有四个方法search,march,replace, split

'abc'.search(/\w+/);  //0 第一个匹配位置

'abc'.match(/[abc]/g); //[a,b,c]

'abc'.replace(/\w/g, '1'); //111, g的作用是全局匹配,没有g则只做一次,就是1bc

'a b c'.split(/\s/); //[a,b,c], 注意匹配的空格被干掉了。

更多匹配后缀, i (ignoreCase), m(mutliLine)

表达式:

方括号:查找范围: [abc],  在abc这个集合间匹配

元字符:常用\d, \w, \s, 大写就是反转

量词:? , * , +, 0-1, 0-n, 1-n 

{n,m} 从n个起,一直到m个,重复

$结尾

^开头