diff --git a/src/regex/match_data.cr b/src/regex/match_data.cr index c7d1f4d2d7f9..b40b7883313d 100644 --- a/src/regex/match_data.cr +++ b/src/regex/match_data.cr @@ -162,7 +162,7 @@ class Regex # matched capture group. # # ``` - # "Crystal".match(/(?Cr)|(?al)/).not_nil!["ok"]? # => "al" + # "Crystal".match(/(?Cr).*(?al)/).not_nil!["ok"]? # => "al" # ``` def []?(group_name : String) max_start = -1 @@ -189,7 +189,7 @@ class Regex # matched capture group. # # ``` - # "Crystal".match(/(?Cr)|(?al)/).not_nil!["ok"] # => "al" + # "Crystal".match(/(?Cr).*(?al)/).not_nil!["ok"] # => "al" # ``` def [](group_name : String) match = self[group_name]?