var ts = "00:00:06,705";
var regularExpression = /([0-9]+):([0-9]{2}):([0-9]{2}),([0-9]{3})/g;
var parsedTs1 = regularExpression.exec(ts);
var parsedTs2 = regularExpression.exec(ts);
The parsedTs1 shows a right result, but the parsedTs2 variable has null after running this script.
But when we removed the last 'g' character at the end, this works well.
The option flag g means, according to the document, global search, which is nothing to do with this case.
How can we use the defined regular expression string multiple times to match strings?