Skip to content

Commit c203064

Browse files
committed
docs: erg-matched-documentation clarify EReg.matched spec regarding capture groups
1 parent 71af60a commit c203064

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

std/EReg.hx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,15 @@ class EReg {
6666
`this.matchSub`, and then operates on the String of that operation.
6767
6868
The index `n` corresponds to the n-th set of parentheses in the pattern
69-
of `this` EReg. If no such sub-group exists, the result is unspecified.
69+
of `this` EReg. If `n` equals 0, the whole matched substring is returned.
7070
71-
If `n` equals 0, the whole matched substring is returned.
71+
If the sub-group `n` was defined in the pattern but did not participate
72+
in the match, `null` is returned.
73+
74+
If no sub-group with index `n` exists in the pattern, the result is
75+
unspecified.
7276
**/
73-
public function matched(n:Int):String {
77+
public function matched(n:Int):Null<String> {
7478
return null;
7579
}
7680

0 commit comments

Comments
 (0)