Project

General

Profile

Actions

Backport #6380

closed

正規表現検索で大文字/小文字の対応がおかしいものがある

Added by 5.5 (5 5) about 12 years ago. Updated almost 12 years ago.

Status:
Rejected
[ruby-dev:45594]

Description

=begin
Unicode のコードチャート

  • http://www.unicode.org/charts/PDF/U0180.pdf
  • http://www.unicode.org/charts/PDF/U0250.pdf
    によれば,
  • U+0241 LATIN CAPITAL LETTER GLOTTAL STOP
  • U+0242 LATIN SMALL LETTER GLOTTAL STOP
    が大文字/小文字の関係にあり,
  • U+0294 LATIN LETTER GLOTTAL STOP
    は「caseless」です。しかし,正規表現検索で i オプションを使うと,U+0241 と U+0294 が大文字/小文字の関係にあるかのような動作になります。

a="\u{241}" # => "Ɂ"
b="\u{242}" # => "ɂ"
c="\u{294}" # => "ʔ"
str=a+b+c

puts str.gsub(/#{a}/i, "-") # => nil
puts str.gsub(/#{b}/i, "-") # => nil
puts str.gsub(/#{c}/i, "-") # => nil

>> -ɂ-

>> Ɂ-ʔ

>> -ɂ-

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0