Skip to content

Commit 7d21662

Browse files
CAD97BurntSushi
authored andcommitted
doc: clarify Captures::len includes non-matching captures
We do the same for CaptureLocations too. Closes #832
1 parent 5e98788 commit 7d21662

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/re_bytes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ impl CaptureLocations {
877877
self.0.pos(i)
878878
}
879879

880-
/// Returns the total number of capturing groups.
880+
/// Returns the total number of capture groups (even if they didn't match).
881881
///
882882
/// This is always at least `1` since every regex has at least `1`
883883
/// capturing group that corresponds to the entire match.
@@ -979,7 +979,7 @@ impl<'t> Captures<'t> {
979979
expand_bytes(self, replacement, dst)
980980
}
981981

982-
/// Returns the number of captured groups.
982+
/// Returns the total number of capture groups (even if they didn't match).
983983
///
984984
/// This is always at least `1`, since every regex has at least one capture
985985
/// group that corresponds to the full match.

src/re_unicode.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ impl CaptureLocations {
887887
self.0.pos(i)
888888
}
889889

890-
/// Returns the total number of capturing groups.
890+
/// Returns the total number of capture groups (even if they didn't match).
891891
///
892892
/// This is always at least `1` since every regex has at least `1`
893893
/// capturing group that corresponds to the entire match.
@@ -989,7 +989,7 @@ impl<'t> Captures<'t> {
989989
expand_str(self, replacement, dst)
990990
}
991991

992-
/// Returns the number of captured groups.
992+
/// Returns the total number of capture groups (even if they didn't match).
993993
///
994994
/// This is always at least `1`, since every regex has at least one capture
995995
/// group that corresponds to the full match.

0 commit comments

Comments
 (0)