Project

General

Profile

Actions

Bug #14488

closed

Unicode characters prevent [[:punct:]] character class from matching certain characters in subsequent matches

Added by patbl (Patrick Brinich-Langlois) almost 7 years ago. Updated about 5 years ago.

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

Description

In 2.3.5, [[:punct:]] doesn't match +. In 2.5.0, it does. In 2.4.3, it matches, but not after you match against a string containing one or more unicode characters. I would expect 2.4.3 to have the behavior of 2.5.0.

puts RUBY_VERSION
p %w[+ é +].grep(/[[:punct:]]/)
2.3.5
[]

2.4.3
["+"]

2.5.0
["+", "+"]

One of the commenters here noticed that this behavior may be related to this issue. It seems that `[$+<=>^|~]`` are affected by the bug, but other punctuation characters aren't (though I tested only a handful of them).

Actions

Also available in: Atom PDF

Like0
Like0