るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.007秒)
トップページ > クラス:Regexp[x] > クエリ:compile[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. mkmf try_compile
  2. _builtin compile
  3. kernel try_compile
  4. ripper compile_error
  5. regexp compile

ライブラリ

検索結果

Regexp#~ -> Integer | nil (8.0)

変数 $_ の値との間でのマッチをとります。

..."

if /foo/
puts "match"
else
puts "no match"
end
# => no match
# ただし、警告がでる。warning: regex literal in condition

reg = Regexp.compile("foo")

if ~ reg
puts "match"
else
puts "no match"
end
# => no match

if reg
puts "match"
else
puts "no match"
end
# => match
# re...