What is a regex “independent non-capturing group”?

It means that the grouping is atomic, and it throws away backtracking information for a matched group. So, this expression is possessive; it won’t back off even if doing so is the only way for the regex as a whole to succeed. It’s “independent” in the sense that it doesn’t cooperate, via backtracking, with other elements of the regex to ensure a match.

Leave a Comment