From 77d1763ae45a16dbf1fb97964b91d86f00ee6640 Mon Sep 17 00:00:00 2001 From: lyszt Date: Sun, 14 Jun 2026 01:56:59 -0300 Subject: [PATCH] docs: erg-matched-documentation clarify EReg.matched spec regarding capture groups --- std/EReg.hx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/std/EReg.hx b/std/EReg.hx index ac34a19d434..4952dca15f7 100644 --- a/std/EReg.hx +++ b/std/EReg.hx @@ -66,11 +66,15 @@ class EReg { `this.matchSub`, and then operates on the String of that operation. The index `n` corresponds to the n-th set of parentheses in the pattern - of `this` EReg. If no such sub-group exists, the result is unspecified. + of `this` EReg. If `n` equals 0, the whole matched substring is returned. - If `n` equals 0, the whole matched substring is returned. + If the sub-group `n` was defined in the pattern but did not participate + in the match, `null` is returned. + + If no sub-group with index `n` exists in the pattern, the result is + unspecified. **/ - public function matched(n:Int):String { + public function matched(n:Int):Null { return null; }