Can anyone tells me why does't the second snippet catchs the 'groups' when use g
flag ?
"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 ?)