[ruby-core:127292] [Ruby Bug#22491] The number of captures may change depending on the encoding of the target string
Issue #22491 has been reported by mame (Yusuke Endoh). ---------------------------------------- Bug #22491: The number of captures may change depending on the encoding of the target string https://bugs.ruby-lang.org/issues/22491 * Author: mame (Yusuke Endoh) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- The number of captures of a Regexp may change depending on the encoding of the target string. ```ruby E = "stateless-ISO-2022-JP" a = "あ".encode("EUC-JP").encode(E) re = Regexp.new("()()#".encode(E) + a + "()()".encode(E), Regexp::EXTENDED) p re.match("ab".encode(E)).size #=> 3 p re.match(a).size #=> 5 (expected: 3) ``` -- https://bugs.ruby-lang.org/
Issue #22491 has been updated by mame (Yusuke Endoh). https://github.com/ruby/ruby/pull/19641 ---------------------------------------- Bug #22491: The number of captures may change depending on the encoding of the target string https://bugs.ruby-lang.org/issues/22491#change-119717 * Author: mame (Yusuke Endoh) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- The number of captures of a Regexp may change depending on the encoding of the target string. ```ruby E = "stateless-ISO-2022-JP" a = "あ".encode("EUC-JP").encode(E) re = Regexp.new("()()#".encode(E) + a + "()()".encode(E), Regexp::EXTENDED) p re.match("ab".encode(E)).size #=> 3 p re.match(a).size #=> 5 (expected: 3) ``` -- https://bugs.ruby-lang.org/
Issue #22491 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED to 3.3: REQUIRED, 3.4: DONE, 4.0: REQUIRED ruby_3_4 commit:1fe5db3586edf57ff67728c07a7bfd27b9aad13b merged revision(s) commit:b4e5cb26164848f4d5b775a624533c4583a73264. ---------------------------------------- Bug #22491: The number of captures may change depending on the encoding of the target string https://bugs.ruby-lang.org/issues/22491#change-119789 * Author: mame (Yusuke Endoh) * Status: Closed * Backport: 3.3: REQUIRED, 3.4: DONE, 4.0: REQUIRED ---------------------------------------- The number of captures of a Regexp may change depending on the encoding of the target string. ```ruby E = "stateless-ISO-2022-JP" a = "あ".encode("EUC-JP").encode(E) re = Regexp.new("()()#".encode(E) + a + "()()".encode(E), Regexp::EXTENDED) p re.match("ab".encode(E)).size #=> 3 p re.match(a).size #=> 5 (expected: 3) ``` -- https://bugs.ruby-lang.org/
Issue #22491 has been updated by k0kubun (Takashi Kokubun). Backport changed from 3.3: REQUIRED, 3.4: DONE, 4.0: REQUIRED to 3.3: REQUIRED, 3.4: DONE, 4.0: DONE ruby_4_0 commit:ebf8b9e8211ebaaf2c5b0bc86b4a835da5f3d593, commit:f9537330eec7d133e5e0031239e6b8bd41ef0218 merged revision(s) commit:b4e5cb26164848f4d5b775a624533c4583a73264, commit:7ec5076439961159c5ce8ebba4416879eb684392. ---------------------------------------- Bug #22491: The number of captures may change depending on the encoding of the target string https://bugs.ruby-lang.org/issues/22491#change-119981 * Author: mame (Yusuke Endoh) * Status: Closed * Backport: 3.3: REQUIRED, 3.4: DONE, 4.0: DONE ---------------------------------------- The number of captures of a Regexp may change depending on the encoding of the target string. ```ruby E = "stateless-ISO-2022-JP" a = "あ".encode("EUC-JP").encode(E) re = Regexp.new("()()#".encode(E) + a + "()()".encode(E), Regexp::EXTENDED) p re.match("ab".encode(E)).size #=> 3 p re.match(a).size #=> 5 (expected: 3) ``` -- https://bugs.ruby-lang.org/
participants (3)
-
k0kubun (Takashi Kokubun) -
mame (Yusuke Endoh) -
nagachika (Tomoyuki Chikanaga)