3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

仮名(など)に対するUnicodeプロパティによるマッチ

Posted at

Unicodeプロパティによる文字クラスがどうマッチするか、Ruby 2.3.1でやってみた。

コード

input_str.scan(regexp).join
対象 \X (?>\p{Hiragana}\p{M}*) (?>\p{Katakana}\p{M}*) \p{In_Hiragana} \p{In_Katakana}
が (\u304c) `` ``
か+合成濁点 (\u304b\u3099) が が `` が ``
か+単独濁点 (\u304b\u309b) か゛ `` か゛ ``
濁点付きの"う" (\u3094) `` ``
う+合成濁点 (\u3046\u3099) ゔ ゔ `` ゔ ``
う+単独濁点 (\u3046\u309b) う゛ `` う゛ ``
濁点付きの"ウ" (\u30f4) `` ``
ウ+合成濁点 (\u30a6\u3099) ヴ `` ヴ
ウ+合成濁点 (\u30a6\u309b) ウ゛ ``
長音記号 (\u30fc) `` `` ``
中黒 (\u30fb) `` `` ``
平仮名繰返し (\u309d\u309e) ゝゞ ゝゞ `` ゝゞ ``
片仮名繰返し (\u30fd\u30fe) ヽヾ `` ヽヾ `` ヽヾ
全角"!" (\uff01) `` `` `` ``
全角"(" (\uff08) `` `` `` ``
全角"0" (\uff10) `` `` `` ``
全角"@" (\uff20) `` `` `` ``
全角"A" (\uff21) `` `` `` ``
全角"" (\uff3c) `` `` `` ``
全角"~" (\uff5e) `` `` `` ``
半角中黒 (\uff65) `` `` `` ``
半角長音記号 (\uff70) `` `` `` ``
半角"カ" (\uff76) `` `` ``
半角"カ"+半角濁点 (\uff76\uff9e) ガ `` `` ``

参考

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?