var str = "For more information, see Chapter 3.4.5.1";
var re = /(chapter \d+(\.\d)*)/i;
var found = str.match(re);
console.log(found);
捕获到了3个结果 : ["Chapter 3.4.5.1", "Chapter 3.4.5.1", ".1"]
而我认为结果应该只有一个 ["Chapter 3.4.5.1"],请问为什么会有3个?
Cats萌萌
随时随地看视频慕课网APP
相关分类