From 1036448fcdc53f49dfa66edbb8edf3400d85bdbe Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Thu, 4 Jun 2015 20:47:15 +0300 Subject: [PATCH] Improve the documentation of MatchGroupCollection. #KT-7938 Fixed --- libraries/stdlib/src/kotlin/text/regex/Regex.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libraries/stdlib/src/kotlin/text/regex/Regex.kt b/libraries/stdlib/src/kotlin/text/regex/Regex.kt index 7e9259ea565..c4ac373db74 100644 --- a/libraries/stdlib/src/kotlin/text/regex/Regex.kt +++ b/libraries/stdlib/src/kotlin/text/regex/Regex.kt @@ -16,15 +16,24 @@ package kotlin.text -/** Represents a collection of captured groups in a single match. */ +/** + * Represents a collection of captured groups in a single match of a regular expression. + * + * Groups are indexed from 1 to the count of groups in the regular expression. + * The first group (with the index 0) corresponds to the entire match. + * + * An element of the collection at the particular index can be `null`, + * if the corresponding group in the regular expression is optional and + * there was not match captured by that group. + */ public interface MatchGroupCollection : Collection { /** Returns a group with the specified [index]. * * @return An instance of [MatchGroup] if the group with the specified [index] was matched or `null` otherwise. * - * The groups are indexed from 1 to the count of groups in regular expression. The group with zero index - * represents the entire match. + * Groups are indexed from 1 to the count of groups in the regular expression. A group with the index 0 + * corresponds to the entire match. */ public fun get(index: Int): MatchGroup?