std.regex - fix issue 12105

Handle the case where a lazy quantified loop will have
pessimistic empty "quick test", for example
in front of a lookaround.
Merge pull request #1959 from blackwhale/issue-12105

std.regex - fix issue 12105
fix issue 12076

Lookaround in ctRegex used wrong number of total captures thus missing
both a bit of optimization AND a special case of 0 matches.
The latter is the reason of range violation in issue 12076.
Merge pull request #1958 from blackwhale/issue-12076

fix issue 12076