diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2019-05-07 09:41:46 +0200 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2019-05-08 17:03:20 +0000 |
commit | 7f5434c44c75f25172d5d6106ad179d2e813bdd1 (patch) | |
tree | 62d2b9e412b7148afb12b7edb79f6050481455f7 /src/regexp/regexp.go | |
parent | 2625fef642becd16773f2376a243029e5d62f739 (diff) | |
download | go-git-7f5434c44c75f25172d5d6106ad179d2e813bdd1.tar.gz |
regexp: clarify docs re Submatch result
Currently we say that a negative index means no match,
but we don't say how "no match" is expressed when 'Index'
is not present. Say how it is expressed.
Change-Id: I82b6c9038557ac49852ac03642afc0bc545bb4a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/175677
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/regexp/regexp.go')
-rw-r--r-- | src/regexp/regexp.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/regexp/regexp.go b/src/regexp/regexp.go index 88122d4250..54cbd3777b 100644 --- a/src/regexp/regexp.go +++ b/src/regexp/regexp.go @@ -46,9 +46,10 @@ // If 'Index' is present, matches and submatches are identified by byte index // pairs within the input string: result[2*n:2*n+1] identifies the indexes of // the nth submatch. The pair for n==0 identifies the match of the entire -// expression. If 'Index' is not present, the match is identified by the -// text of the match/submatch. If an index is negative, it means that -// subexpression did not match any string in the input. +// expression. If 'Index' is not present, the match is identified by the text +// of the match/submatch. If an index is negative or text is nil, it means that +// subexpression did not match any string in the input. For 'String' versions +// an empty string means either no match or an empty match. // // There is also a subset of the methods that can be applied to text read // from a RuneReader: |