12件ヒット
[1-12件を表示]
(0.008秒)
別のキーワード
ライブラリ
- ビルトイン (12)
検索結果
-
Regexp
# ~ -> Integer | nil (8.0) -
変数 $_ の値との間でのマッチをとります。
...][ruby]{
$_ = "hogehoge"
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 mat...