我正在尝试将正则表达式组合在一起。这是我的意思的一个例子:
var string = 'This is a test string This is a test string';
var regex = /(This)(.+)(string)/g;
var ar = regex.exec(string);
/* output is:
'This is a test string This is a test string'
'This'
'is a test string This is a test'
'string' */
我想要的是一种将这些组合在一起的方法,所以输出是:
/* 'This is a test string This is a test string'
'This is a test string'
'This is a test string' */
如何查找正则表达式的所有实例?