るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
4件ヒット [1-4件を表示] (0.145秒)

別のキーワード

  1. httpstatus rc_see_other
  2. webrick/httpstatus rc_see_other
  3. rc_see_other webrick/httpstatus
  4. rc_see_other webrick::httpstatus

ライブラリ

キーワード

検索結果

Regexp#===(string) -> bool (61.0)

文字列 string との正規表現マッチを行います。 マッチした場合は真を返します。

文字列 string との正規表現マッチを行います。
マッチした場合は真を返します。

string が文字列でもシンボルでもない場合には false を返します。

このメソッドは主にcase文での比較に用いられます。

@param string マッチ対象文字列

//emlist[例][ruby]{
a = "HELLO"
case a
when /\A[a-z]*\z/; puts "Lower case"
when /\A[A-Z]*\z/; puts "Upper case"
else; puts "Mixed case"
end
# => Upper ...

Regexp#encoding -> Encoding (43.0)

正規表現オブジェクトのエンコーディングを表す Encoding オブジェクト を返します。

...正規表現オブジェクトのエンコーディングを表す Encoding オブジェクト
を返します。


@see d:spec/regexp#encoding...

Regexp#inspect -> String (43.0)

Regexp#to_s より自然な文字列を返します。

...Regexp#to_s より自然な文字列を返します。

//emlist[例][ruby]{
p /^ugou.*?/i.to_s # => "(?i-mx:^ugou.*?)"
p /^ugou.*?/i.inspect # => "/^ugou.*?/i"
//}

@see Regexp#to_s...

Regexp#to_s -> String (43.0)

正規表現の文字列表現を生成して返します。返される文字列は他の正規表 現に埋め込んでもその意味が保持されるようになっています。

...emlist[][ruby]{
re = /(foo|bar)\1/ # \1 は、foo か bar
p /(baz)#{re}/ # \1 は、baz

# => /(baz)(?-mix:(foo|bar)\1)/
//}

//emlist[使用例][ruby]{
re = /foo|bar|baz/i
p re.to_s # => "(?i-mx:foo|bar|baz)"
p /#{re}+/o # => /(?i-mx:foo|bar|baz)+/
//}

@see Regexp#inspect...