以下の内容はhttps://shuzo-kino.hateblo.jp/entry/2014/10/18/235040より取得しました。


正規表現のCharacter Propertiesで通貨や平仮名、ラテン語までキャッチする

Character Propertiesをつかうと、
平仮名や片仮名、果ては通貨記号までキャッチする事が出来ます

/\p{hiragana}+/.match "ほげpiyoふが"
#=> #<MatchData "ほげ">
/\p{Sc}+/.match "¥120,000."
#=> #<MatchData "¥">

/\p{Sc}+/.match "$1,123."
#=> #<MatchData "$">

/\p{Sc}+/.match "130,000₫"
#=> #<MatchData "₫">

残念ながら、Unicode7から採用のロシアルーブルは未対応です

/\p{Sc}+/.match "100₽"
#=> nil
/[\p{latin}|\p{Blank}]+/.match "Si Vis Pacem, Para Bellum"
=> #<MatchData "Si Vis Pacem">

Class: Regexp (Ruby 2.0.0)




以上の内容はhttps://shuzo-kino.hateblo.jp/entry/2014/10/18/235040より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14