Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

of

Ruby 2.0.0 での正規表現の新機能 Slide 1 Ruby 2.0.0 での正規表現の新機能 Slide 2 Ruby 2.0.0 での正規表現の新機能 Slide 3 Ruby 2.0.0 での正規表現の新機能 Slide 4 Ruby 2.0.0 での正規表現の新機能 Slide 5 Ruby 2.0.0 での正規表現の新機能 Slide 6 Ruby 2.0.0 での正規表現の新機能 Slide 7 Ruby 2.0.0 での正規表現の新機能 Slide 8 Ruby 2.0.0 での正規表現の新機能 Slide 9 Ruby 2.0.0 での正規表現の新機能 Slide 10 Ruby 2.0.0 での正規表現の新機能 Slide 11 Ruby 2.0.0 での正規表現の新機能 Slide 12 Ruby 2.0.0 での正規表現の新機能 Slide 13
Upcoming SlideShare
Rubyな日々
Next
Download to read offline and view in fullscreen.

4 Likes

Share

Download to read offline

Ruby 2.0.0 での正規表現の新機能

Download to read offline

2.0.0 は正規表現エンジンが Onigmo になって機能が増えていますが、あまり情報がなかったので、調べてわかった範囲の内容を発表しました。

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Ruby 2.0.0 での正規表現の新機能

  1. 1. Regexp.new('2.0.0') Ruby 2.0.0 での正規表現の新機能 西山和広 日本Rubyの会 Powered by Rabbit 2.0.8
  2. 2. Onigmo Onigmo (Oniguruma-mod) NEWS of Ruby 2.0.0 says following only: Merge Onigmo https://github.com/k-takata/Onigmo Details are unknown 詳細不明 1/12
  3. 3. New feature (1) K examples without /K/ "foobar".sub(/(?<=foo)bar/, "") #=> "foo" "foobar".sub(/(?<=fo*)bar/, "") # SyntaxError: invalid pattern in look-behind: /(?<=fo*)bar/ examples with /K/ "foobar".sub(/fooKbar/, "") #=> "foo" "foobar".sub(/fo*Kbar/, "") #=> "foo" 2/12
  4. 4. New feature (1) K Treat the first non-blank character of the line. examples with /K/ gsub(/^ *K(d+)/) { $1.to_i+1 } examples without /K/ gsub(/^( *)(d+)/) { "#{$1}#{$2.to_i+1}" } 3/12
  5. 5. New feature (2) R Linebreak 改行文字 Unicode: (?>x0Dx0A|[x0A-x0Dx{85}x{2028}x{2029}]) Not Unicode: (?>x0Dx0A|[x0A-x0D]) 4/12
  6. 6. New feature (3) X eXtended grapheme cluster 拡張書記素クラスタ Unicode: (?>P{M}p{M}*) Not Unicode: (?m:.) 5/12
  7. 7. Extended grapheme cluster example: "u{304B 3099}"[/X/].size #=> 2 U+304B HIRAGANA LETTER KA U+3099 COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK see [UAX #29] for more detail (Unicode標準附属書29) 6/12
  8. 8. New feature (4) conditional expression: (?(cond)yes) (?(cond)yes|no) example: " :f o o "[/:(['"])?(?(1)[ws]+1|w+)/] #=> ":f" ":'f o o'"[/:(['"])?(?(1)[ws]+1|w+)/] #=> ":'f o o'" 7/12
  9. 9. (?adu) character set option (character range option) 文字集合オプション (文字範囲オプション) d: Default (compatible with Ruby 1.9.3) a: ASCII u: Unicode see doc/RE in Onigmo for more detail 8/12
  10. 10. (?adu) examples: "u{3042}"[/w/] #=> nil "u{3042}"[/(?a)w/] #=> nil "u{3042}"[/(?d)w/] #=> nil "u{3042}"[/(?u)w/] #=> "あ" /ab/ =~ "au{3042}" #=> nil /(?a)ab/ =~ "au{3042}" #=> 0 /(?d)ab/ =~ "au{3042}" #=> nil /(?u)ab/ =~ "au{3042}" #=> nil 9/12
  11. 11. (?adu) (?-a), (?-d), (?-u) do not found unlike (?-i), (?-m), (?-x) 10/12
  12. 12. Character Property support for Unicode blocks example: /p{InHiragana}/ =~ "u3042" #=> 0 /p{InCJKUnifiedIdeographs}/ =~ "u3042" #=> nil see tool/enc-unicode.rb in Onigmo for more detail 11/12
  13. 13. /z/
  • tetsuyaonoda

    Jan. 17, 2014
  • lajixinxi

    Jun. 3, 2013
  • fumiyas

    Jun. 2, 2013
  • TokyoIncidents

    Jun. 1, 2013

2.0.0 は正規表現エンジンが Onigmo になって機能が増えていますが、あまり情報がなかったので、調べてわかった範囲の内容を発表しました。

Views

Total views

2,007

On Slideshare

0

From embeds

0

Number of embeds

62

Actions

Downloads

6

Shares

0

Comments

0

Likes

4

×