<分区>
我有字符串,想通过正则表达式捕获一个片段:
var regex = new RegExp("(\s?.{0,2}the.{0,2}\s?)", "i");
var str= " the apple the apple the apple the apple the apple the apple the apple"
alert(str.match(regex))
目标是捕获第一个“max 3 symbol with(within) space”+“the”+“max 3 symbol with(within) space”
我不明白为什么结果是重复的 ------> a, the a