Project

General

Profile

Actions

Bug #22491

closed

The number of captures may change depending on the encoding of the target string

Bug #22491: The number of captures may change depending on the encoding of the target string

Added by mame (Yusuke Endoh) 23 days ago. Updated 9 days ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:127292]

Description

The number of captures of a Regexp may change depending on the encoding of the target string.

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)
Actions

Also available in: PDF Atom