るりまサーチ

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

別のキーワード

  1. _builtin to_c
  2. etc sc_2_c_dev
  3. etc sc_2_c_bind
  4. tracer display_c_call
  5. tracer display_c_call=

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

CSV::DateMatcher -> Regexp (26201.0)

日付 (Date) 形式のデータを発見したり変換したりするための正規表現です。

日付 (Date) 形式のデータを発見したり変換したりするための正規表現です。

CSV::DateTimeMatcher -> Regexp (26201.0)

日時 (DateTime) 形式のデータを発見したり変換したりするための正規表現です。

日時 (DateTime) 形式のデータを発見したり変換したりするための正規表現です。

MatchData#regexp -> Regexp (21208.0)

自身の元になった正規表現オブジェクトを返します。

...自身の元になった正規表現オブジェクトを返します。

//emlist[例][ruby]{
m = /a.*b/.match("abc")
m.regexp # => /a.*b/
//}...

URI.regexp(schemes) -> Regexp (18310.0)

URIにマッチする正規表現を返します。

...URIにマッチする正規表現を返します。

schemes を与えた場合は、そのスキームの URI にのみマッチする
正規表現を返します。

いずれの場合も返り値の正規表現は不定数の正規表現グループ
(括弧) を含みます。この括弧の数...
...どうかは必要に応じて別途
検査してください。

このメソッドは Ruby 2.2 から obsolete です。

@param schemes マッチさせたいスキームを、文字列の配列として与えます。

例:
require 'uri'
p URI.regexp =~ "http://www.ruby-lang.org/" #=> 0...

Regexp.compile(string, option = nil, code = nil) -> Regexp (15410.0)

文字列 string をコンパイルして正規表現オブジェクトを生成して返します。

...ram option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp
::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp
::IGNORECASE の指...
...定と同じになります。

@param code "n", "N" が与えられた時には、生成された正規表現のエンコーディングは ASCII-8BIT になります。
それ以外の指定は警告を出力します。

@raise RegexpError 正規表現のコンパイルに失敗し...
...is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
p $~ # => "This is Regexp"

t2 = Regexp.compile('
this # ここは使用されない
\ is
\ regexp # ここも使用されない
', Regexp::EXTENDED | Regexp::IGNORECASE)
t2.match(str)
p Regexp.last_match...

絞り込み条件を変える

Regexp.compile(string, option = nil) -> Regexp (15310.0)

文字列 string をコンパイルして正規表現オブジェクトを生成して返します。

...ram option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp
::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp
::IGNORECASE の指...
...じになります。

@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。

//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
p $~ # => "This is Regexp"

t2 = Regexp.compile('
this # こ...
...れない
\ is
\ regexp # ここも使用されない
', Regexp::EXTENDED | Regexp::IGNORECASE)
t2.match(str)
p Regexp.last_match # => "This is Regexp"

str = "ふるいけや\nかわずとびこむ\nみずのおと"
t2 = Regexp.compile("ふる.*?と", Regexp::MULTILINE)
p t2.match(str)[0] # =>...

Regexp.last_match -> MatchData (15258.0)

カレントスコープで最後に行った正規表現マッチの MatchData オ ブジェクトを返します。このメソッドの呼び出しは $~ の参照と同じです。

...MatchData オ
ブジェクトを返します。このメソッドの呼び出しは $~
の参照と同じです。

//emlist[例][ruby]{
/(.)(.)/ =~ "ab"
p Regexp.last_match # => #<MatchData:0x4599e58>
p Regexp.last_match[0] # => "ab"
p Regexp.last_match[1] # => "a"
p Regexp.last_match[2]...
...# => "b"
p Regexp.last_match[3] # => nil
//}...

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

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

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

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

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

Regexp#encoding -> Encoding (15222.0)

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

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


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

Regexp#match(str, pos = 0) -> MatchData | nil (15218.0)

指定された文字列 str に対して位置 pos から自身が表す正規表現によるマッ チングを行います。マッチした場合には結果を MatchData オブジェクトで返し ます。 マッチしなかった場合 nil を返します。

...atchData オブジェクトで返し
ます。
マッチしなかった場合 nil を返します。

省略可能な第二引数 pos を指定すると、マッチの開始位置を pos から行
うよう制御できます(pos のデフォルト値は 0)。

//emlist[例][ruby]{
p(/(.).(.)/.match(...
..."foobar", 3).captures) # => ["b", "r"]
p(/(.).(.)/.match("foobar", -3).captures) # => ["b", "r"]
//}

pos を指定しても MatchData#offset 等の結果
には影響しません。つまり、
//emlist[][ruby]{
re.match(str[pos..-1])
//}

//emlist[][ruby]{
re.match(str, pos)
//}
は異なり...
...s のデフォルト値は 0)。

//emlist[例][ruby]{
reg = Regexp.new("foo")

if reg.match("foobar")
puts "match"
end
# => match

p reg.match("foobar") # => #<MatchData:0x29403fc>
p reg.match("bar") # => nil

p /(foo)(bar)(baz)/.match("foobarbaz").to_a.values_at(1,2,3) # => ["foo", "bar", "ba...

絞り込み条件を変える

<< 1 2 3 ... > >>