【文件属性】:
文件名称:execall:在一个字符串中查找多个RegExp匹配项
文件大小:5KB
文件格式:ZIP
更新时间:2021-05-01 02:28:18
JavaScript
调用
在一个字符串中查找多个RegExp匹配项
不必遍历RegExp#exec ,不可变的并且具有更好的结果格式。
安装
$ npm install execall
用法
import execAll from 'execall' ;
execAll ( / ( \d + ) / g , '$200 and $400' ) ;
/*
[
{
match: '200',
subMatches: ['200'],
index: 1
},
{
match: '400',
subMatches: ['400'],
index: 10
}
]
*/
原料药
execAll(regexp,字符串)
返回带有匹配项,子匹配项和索引的object[] 。
正则表达式
类型: RegExp
正则表达式匹配string 。
细绳
类型: string
有关的
替换字符串中的
【文件预览】:
execall-main
----index.test-d.ts(133B)
----.gitattributes(19B)
----.github()
--------workflows()
----test.js(327B)
----license(1KB)
----index.d.ts(535B)
----.npmrc(19B)
----.editorconfig(175B)
----.gitignore(23B)
----index.js(465B)
----readme.md(734B)
----package.json(853B)