2017.03.27 【続き】Ruby 2.4.1のOnigmo非包含演算子をあえて単独で`#match?`で使ってみた こんにちは、hachi8833です。先週のTechRacho記事「Ruby 2.4.1新機能: Onigmo正規表現の非包含演算子(?~ )をチェック」の続編です。 ここで行っている非包含演算子の単独利用は挙動を理解するための極端なケースであり、実用的な意味はありませんのでご了承ください。 非包含演算子の挙動 「Ruby 2.4.1新機能: Onigmo正規表現の非包含演算子(?~ )をチェック」記事を作成中に以下のサンプルコードを見ていて、ふと気になった点がありました。 "うらにはにわにわにはにわにわとりがいる".match?(/(?~でも)/) #=> true "うらにはにわにわにはにわにわとりがいる".match?(/(?~には)/) #=> true 空文字列