From 106d44dc8bbf3a0d4f486318e39543d4142fc1ca Mon Sep 17 00:00:00 2001 From: TSUYUSATO Kitsune Date: Wed, 4 Apr 2018 23:01:43 +0900 Subject: [PATCH] MatchData: correct sample code for duplicated named capture Ref: https://github.com/crystal-lang/crystal/pull/5912#issuecomment-378495637 --- src/regex/match_data.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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]?