mirror of
https://github.com/github/codeql.git
synced 2025-12-20 18:56:32 +01:00
don't give group numbers to non-capturing groups
This commit is contained in:
@@ -462,6 +462,7 @@ abstract class RegexString extends Expr {
|
|||||||
/** Gets the number of the group in start,end */
|
/** Gets the number of the group in start,end */
|
||||||
int getGroupNumber(int start, int end) {
|
int getGroupNumber(int start, int end) {
|
||||||
this.group(start, end) and
|
this.group(start, end) and
|
||||||
|
not this.non_capturing_group_start(start, _) and
|
||||||
result =
|
result =
|
||||||
count(int i | this.group(i, _) and i < start and not this.non_capturing_group_start(i, _)) + 1
|
count(int i | this.group(i, _) and i < start and not this.non_capturing_group_start(i, _)) + 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user