Skip to content

Commit fd64ff9

Browse files
committed
don't give group numbers to non-capturing groups
1 parent c40ffab commit fd64ff9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

python/ql/lib/semmle/python/regex.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ abstract class RegexString extends Expr {
462462
/** Gets the number of the group in start,end */
463463
int getGroupNumber(int start, int end) {
464464
this.group(start, end) and
465+
not this.non_capturing_group_start(start, _) and
465466
result =
466467
count(int i | this.group(i, _) and i < start and not this.non_capturing_group_start(i, _)) + 1
467468
}

0 commit comments

Comments
 (0)