Closed User4martin closed 1 year ago
The below code basically means, that NumberFound will be true for any $1 to $89 But not for $90 and up.
NumberFound
$1
$89
$90
That seems are strange choice.
RegexMaxGroups = 90; GrpIndexes: array [0 .. RegexMaxGroups - 1] of integer; // map global group index to _capturing_ group index
procedure FindSubstGroupIndex(var p: PRegExprChar; var Idx: integer; var NumberFound: boolean); begin Idx := ParseVarName(p); NumberFound := (Idx >= 0) and (Idx <= High(GrpIndexes));
The test asserts, that a number not present is ignored. But that works only up to 89. And then behaviour changes.
// 70 ( expression: '(b)'; inputText: 'abc'; substitutionText: '$1$2$9'; expectedResult: 'abc'; matchStart: 1 ),
Changing that test to $1$2$90 leads to a result of ab$c
$1$2$90
ab$c
IMHO, any $123 ... that does not have a group should be "".
@Alexey-T
Good catch. Agree with that.
Is included in https://github.com/User4martin/TRegExpr/commits/group-idx
The below code basically means, that
NumberFound
will be true for any$1
to$89
But not for$90
and up.That seems are strange choice.
The test asserts, that a number not present is ignored. But that works only up to 89. And then behaviour changes.
Changing that test to
$1$2$90
leads to a result ofab$c
IMHO, any $123 ... that does not have a group should be "".