consider the following code:
let x='father';
let m=x.match(/fa(.?)(.?)er/g); // x == ["father"]
let m=x.match(/fa(.?)(.?)er/); // x == ["father", "t", "h"]
So with the 'g' global flags, the capturing groups do not match. Why does this happen ?
consider the following code:
let x='father';
let m=x.match(/fa(.?)(.?)er/g); // x == ["father"]
let m=x.match(/fa(.?)(.?)er/); // x == ["father", "t", "h"]
So with the 'g' global flags, the capturing groups do not match. Why does this happen ?