任何人都可以告诉我为什么第二个片段会抓住'群组'何时使用g
标志?
"123".match(/(\d{1})(\d{1})/) // returns ["12", "1", "2"]
"123".match(/(\d{1})(\d{1})/g) // returns ["12"] (where's 1 and 2 ?)
console.log("123".match(/(\d{1})(\d{1})/)) // returns ["12", "1", "2"]
console.log("123".match(/(\d{1})(\d{1})/g)) // returns ["12"] (where's 1 and 2 ?)