当前位置:网站首页>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第13篇:Makefile编译问题合集
- 这款可视化工具神器,更直观易用!太爱了
- uni-app微信小程序——下拉多选框
- pytorch手撕CNN
- make & cmake
- 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
- MySQL:MySQL的集群——主从复制的原理和配置
- 基于交流潮流的电力系统多元件N-k故障模型研究(Matlab代码实现)【电力系统故障】
- 服务——DHCP原理与配置
- 【640. Solving Equations】
猜你喜欢
一篇文章教你Pytest快速入门和基础讲解,一定要看
合并k个已排序的链表
The Thread State,
MySQL:MySQL的集群——主从复制的原理和配置
Power system power flow calculation (Newton-Raphson method, Gauss-Seidel method, fast decoupling method) (Matlab code implementation)
使用 Cloudreve 搭建私有云盘
What are the concepts, purposes, processes, and testing methods of interface testing?
LeetCode-498 - Diagonal Traversal
August 10, 2022: Building Web Applications for Beginners with ASP.NET Core -- Creating Web UIs with ASP.NET Core
3598. 二叉树遍历(华中科技大学考研机试题)
随机推荐
阿里云贾朝辉:云XR平台支持彼真科技呈现国风科幻虚拟演唱会
shell编程之正则表达式与文本处理器
How many threads does LabVIEW allocate?
带着昇腾去旅行:一日看尽金陵城里的AI胜景
留言有奖|OpenBMB x 清华大学NLP:大模型公开课更新完结!
爬虫request.get()出现错误
Using SylixOS virtual serial port, serial port free implementation system
使用 Cloudreve 搭建私有云盘
【640. 求解方程】
亲测有效|处理风控数据特征缺失的一种方法
FPGA - Memory Resources of 7 Series FPGA Internal Structure -03- Built-in Error Correction Function
68: Chapter 6: Develop article services: 1: Content sorting; article table introduction; creating [article] article services;
美味石井饭菜
STL-stack
Redis Performance Impact - Asynchronous Mechanisms and Response Latency
Black cats take you learn Makefile article 13: a Makefile collection compile problem
VLAN huawei 三种模式
The Thread State,
黑猫带你学Makefile第12篇:常见Makefile问题汇总
虚拟地址空间