るりまサーチ

最速Rubyリファレンスマニュアル検索!
3421件ヒット [1-100件を表示] (0.103秒)
トップページ > クエリ:r[x] > クエリ:Regexp[x]

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils cp_r
  5. fileutils rm_r

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Regexp (44060.0)

正規表現のクラス。正規表現のリテラルはスラッシュで囲んだ形式 で記述します。

...t[][ruby]{
/^this is regexp/
//}

Regexp
.new(string) を使って正規表現オブジェクトを動的に生成する
こともできます。

//emlist[][ruby]{
str = "this is regexp"
r
p1 = Regexp.new("^this is regexp")
p rp1 =~ str # => 0
p Regexp.last_match[0] # => "this is regexp"
//...
...}


spec/regexp や d:spec/literal#regexp も参照してください。...
...ruby]{
/^this is regexp/
//}

Regexp
.new(string) を使って正規表現オブジェクトを動的に生成する
こともできます。

//emlist[][ruby]{
str = "this is regexp"
r
p1 = Regexp.new("^this is regexp")
p rp1 =~ str # => 0
p Regexp.last_match[0] # => "this is regexp"
//}

R
...
...uby 3.0.0 から正規表現リテラルは freeze されるようになりました。
//emlist[][ruby]{
p /abc/.frozen?
# => true
p /a#{42}bc/.frozen?
# => true
p Regexp.new('abc').frozen?
# => false
//}

spec/regexp や d:spec/literal#regexp も参照してください。...

Regexp.json_create(hash) -> Regexp (30301.0)

JSON のオブジェクトから Ruby のオブジェクトを生成して返します。

...JSON のオブジェクトから Ruby のオブジェクトを生成して返します。

@param hash 適切なキーを持つハッシュを指定します。...

Regexp#named_captures -> { String => [Integer] } (30100.0)

正規表現に含まれる名前付きキャプチャ(named capture)の情報を Hash で返します。

...named capture)の情報を
Hash で返します。

Hash のキーは名前付きキャプチャの名前で、値は
その名前に関連付けられたキャプチャの index のリストを返します。

//emlist[例][ruby]{
/(?<foo>.)(?<bar>.)/.named_captures
# => {"foo"=>[1], "bar"=>[2]}

/...
...(?<foo>.)(?<foo>.)/.named_captures
# => {"foo"=>[1, 2]}

# 名前付きキャプチャを持たないときは空の Hash を返します。
/(.)(.)/.named_captures
# => {}
//}...

Regexp::IGNORECASE -> Integer (30100.0)

文字の大小の違いを無視します。 正規表現リテラルの //i オプションと同じです。

文字の大小の違いを無視します。
正規表現リテラルの //i オプションと同じです。

Regexp.try_convert(obj) -> Regexp | nil (27245.0)

obj を to_regexp メソッドで Regexp オブジェクトに変換しようと 試みます。

...obj を to_regexp メソッドで Regexp オブジェクトに変換しようと
試みます。

変換に成功した場合はそれを返し、失敗時には nil を返します。

//emlist[例][ruby]{
Regexp
.try_convert(/re/) # => /re/
Regexp
.try_convert("re") # => nil
//}...

絞り込み条件を変える

Regexp#source -> String (27100.0)

その正規表現のもととなった文字列表現を生成して返します。

...その正規表現のもととなった文字列表現を生成して返します。

//emlist[例][ruby]{
r
e = /foo|bar|baz/i
p re.source # => "foo|bar|baz"
//}...

rubygems/commands/query_command (26012.0)

Gem パッケージの情報を検索するためのライブラリです。

...索するためのライブラリです。

Usage: gem query [options]
Options:
-i, --[no-]installed Check for installed gem
-v, --version VERSION Specify version of gem to query
-n, --name-matches REGEXP 与えられた正規表現にマッチする Gem...
...rsions Gem パッケージ名のみ表示します
-a, --all 見つかった Gem パッケージの全てのバージョンを表示します
Local/Remote Options:
-l, --local 操作をローカルに限定します
-r, --r...
...-B, --bulk-threshold COUNT Threshold for switching to bulk
synchronization (default 1000)
--source URL Gem パッケージのリモートリポジトリの URL を指定します
--[no-]http-proxy [URL] リモ...

Regexp.union(*pattern) -> Regexp (24383.0)

引数として与えた pattern を選択 | で連結し、Regexp として返します。 結果の Regexp は与えた pattern のどれかにマッチする場合にマッチするものになります。

...引数として与えた pattern を選択 | で連結し、Regexp として返します。
結果の Regexp は与えた pattern のどれかにマッチする場合にマッチするものになります。

//emlist[][ruby]{
p Regexp.union(/a/, /b/, /c/) # => /(?-mix:a)|(?-mix:b)|(?-mix:c)/
//}...
...Array を与えても Regexp を生成します。
つまり、以下のように書くことができます。

//emlist[][ruby]{
arr = [/a/, /b/, /c/]
p Regexp.union(arr) # => /(?-mix:a)|(?-mix:b)|(?-mix:c)/
# 1.8.7 より前は、以下のように書く必要があった
p Regexp.union(*arr) #...
...ttern は Regexp または String で与えます。
String で与えた場合、それ自身と等しい文字列にマッチするものと解釈され、
エスケープされて結果の Regexp に組み込まれます。

//emlist[][ruby]{
p Regexp.union("a", "?", "b") # => /a|\?|b/
p Regexp.un...

Regexp#options -> Integer (24306.0)

正規表現の生成時に指定されたオプションを返します。戻り値は、 Regexp::EXTENDED, Regexp::IGNORECASE, Regexp::MULTILINE, Regexp::FIXEDENCODING, Regexp::NOENCODING, の論理和です。

...正規表現の生成時に指定されたオプションを返します。戻り値は、
Regexp
::EXTENDED, Regexp::IGNORECASE,
Regexp
::MULTILINE,
Regexp
::FIXEDENCODING,
Regexp
::NOENCODING,
の論理和です。

これで得られるオプションには生成時に指定したもの以外の
...
...Regexp.new にこれらを
渡しても無視されます。

//emlist[例][ruby]{
p Regexp::IGNORECASE # => 1
p //i.options # => 1

p Regexp.new("foo", Regexp::IGNORECASE ).options # => 1
p Regexp.new("foo", Regexp::EXTENDED).options # => 2
p Regexp.new("foo", Regexp::IGNORECASE | Regexp:...
...options # => 3
p Regexp.new("foo", Regexp::MULTILINE).options # => 4
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::MULTILINE ).options # => 5
p Regexp.new("foo", Regexp::MULTILINE | Regexp::EXTENDED).options # =>6
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::MULTILINE | Regexp::EXTENDED).opti...
<< 1 2 3 ... > >>