当前位置:网站首页>JS use regular expressions in g model and non g difference
JS use regular expressions in g model and non g difference
2022-08-10 22:41:00 【Breeze and drizzle_Linmumu】
Meaning
g is the abbreviation of global!It is to match all matching results.
- Without g, in the regular process, the string is matched from left to right, if the match is successful, it will not continue to match to the right;
- With g, it will pick out the correct matching string from beginning to end
Instance
var str = 'aaaaaaaa'var reg1 = /a/var reg2 = /a/gstr.match(reg1) // The result is: ["a", index: 0, input: "aaaaaaaa"]str.match(reg2) // The result is: ["a", "a", "a", "a", "a", "a", "a", "a"]
边栏推荐
- What is Jmeter? What are the principle steps used by Jmeter?
- Black cats take you learn Makefile article 13: a Makefile collection compile problem
- 特别的三杯鸡
- 高通平台开发系列讲解(应用篇)QCMAP应用框架介绍
- Shell programming specification and variables
- LeetCode Daily 2 Questions 01: Reverse Strings (both 1200) Method: Double Pointer
- 测试4年感觉和1、2年时没什么不同?这和应届生有什么区别?
- LeetCode每日两题02:反转字符串中的单词 (均1200道)
- 链表相加(二)
- file IO-buffer
猜你喜欢
uni-app微信小程序——下拉多选框
一篇文章教你Pytest快速入门和基础讲解,一定要看
《DevOps围炉夜话》- Pilot - CNCF开源DevOps项目DevStream简介 - feat. PMC成员胡涛
How to be a Righteous Hacker?What should you study?
高数_复习_第5章:多元函数微分学
mmpose关键点(一):评价指标(PCK,OKS,mAP)
Play RT-THREAD of doxygen
Distribution Network Expansion Planning: Consider Decisions Using Probabilistic Energy Production and Consumption Profiles (Matlab Code Implementation)
2022年8月的10篇论文推荐
VLAN huawei 三种模式
随机推荐
QT笔记——QT工具uic,rcc,moc,qmake的使用和介绍
shell编程之正则表达式与文本处理器
JS中使用正则表达式g模式和非g模式的区别
Black cat takes you to learn Makefile Part 11: When the header file a.h changes, how to recompile all the .c files that depend on the header file a.h
高通平台开发系列讲解(应用篇)QCMAP应用框架介绍
ASCII、Unicode和UTF-8
IM 即时通讯开发如何设计图片文件的服务端存储架构
新一代网络安全防护体系的五个关键特征
Conditional Statements of Shell Programming (2)
C # Hex file transfer skills necessary article 】 【 bin file code implementation
链表中的节点每k个一组翻转
LeetCode-498 - Diagonal Traversal
68: Chapter 6: Develop article services: 1: Content sorting; article table introduction; creating [article] article services;
BM7 链表中环的入口结点
接口测试的概念、目的、流程、测试方法有哪些?
阿里云贾朝辉:云XR平台支持彼真科技呈现国风科幻虚拟演唱会
Why general company will say "go back messages such as" after the end of the interview, rather than just tell the interviewer the result?
财务年报怎样翻译,为什么要选择专业翻译公司?
port forwarding
APP UI自动化测试常见面试题,或许有用呢~