当前位置:网站首页>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"]边栏推荐
- 黑猫带你学Makefile第11篇:当头文件a.h改变时,如何将所有依赖头文件a.h的.c文件都重新编译
- 如何成为一名正义黑客?你应该学习什么?
- BM13判断一个链表是否为回文结构
- 罗克韦尔AB PLC RSLogix5000中计数器指令使用方法介绍
- LeetCode-498 - Diagonal Traversal
- How to be a Righteous Hacker?What should you study?
- STL-stack
- What are the concepts, purposes, processes, and testing methods of interface testing?
- 元宇宙社交应用,靠什么吸引用户「为爱发电」?
- pytorch手撕CNN
猜你喜欢

12 Recurrent Neural Network RNN2 of Deep Learning

ThreadLocal comprehensive analysis (1)

68:第六章:开发文章服务:1:内容梳理;article表介绍;创建【article】文章服务;

String类的常用方法

Shell programming specification and variables

虚拟地址空间

Redis Performance Impact - Asynchronous Mechanisms and Response Latency

一篇文章教你Pytest快速入门和基础讲解,一定要看

VLAN huawei 三种模式

爬虫request.get()出现错误
随机推荐
测试4年感觉和1、2年时没什么不同?这和应届生有什么区别?
BM13 determines whether a linked list is a palindrome
“数据引擎”开启前装规模量产新赛道,「智协慧同」崭露头角
Common interview questions for APP UI automation testing, maybe useful~
如何成为一名正义黑客?你应该学习什么?
BM7 链表中环的入口结点
Shell编程之条件语句(二)
电力系统潮流计算(牛顿-拉夫逊法、高斯-赛德尔法、快速解耦法)(Matlab代码实现)
虚拟地址空间
ThreadLocal comprehensive analysis (1)
元宇宙社交应用,靠什么吸引用户「为爱发电」?
virtual address space
Using SylixOS virtual serial port, serial port free implementation system
shell编程之免交互
STL-stack
边缘与云计算:哪种解决方案更适合您的连接设备?
shell脚本
shell(文本打印工具awk)
服务——DNS正向反向域名解析服务
String类的常用方法