るりまサーチ

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

別のキーワード

  1. resolv regex
  2. ipv4 regex
  3. ipv6 regex
  4. ipv6 regex_8hex
  5. resolv regex_8hex

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Scanf::FormatString::REGEX (18117.0)

@todo

...@todo...

URI.regexp -> Regexp (6206.0)

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

...どうかは必要に応じて別途
検査してください。

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

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

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

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

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 (3124.0)

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

...製して返します。第二、第三引数は警告の上無視されます。

@
param string 正規表現を文字列として与えます。

@
param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regex
p::EXTENDED
の論理和を指定します。
Integer...
...れば
Regex
p::IGNORECASE の指定と同じになります。

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

@
raise RegexpErro...
..."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_...

Regexp.new(string, option = nil, code = nil) -> Regexp (3124.0)

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

...製して返します。第二、第三引数は警告の上無視されます。

@
param string 正規表現を文字列として与えます。

@
param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regex
p::EXTENDED
の論理和を指定します。
Integer...
...れば
Regex
p::IGNORECASE の指定と同じになります。

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

@
raise RegexpErro...
..."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_...

絞り込み条件を変える

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

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

...数を複製して返します。第二引数は警告の上無視されます。

@
param string 正規表現を文字列として与えます。

@
param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regex
p::EXTENDED
の論理和を指定します。
Integer...
...false 以外)であれば
Regex
p::IGNORECASE の指定と同じになります。

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

//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(s...
...xp"

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.new(string, option = nil) -> Regexp (3118.0)

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

...数を複製して返します。第二引数は警告の上無視されます。

@
param string 正規表現を文字列として与えます。

@
param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regex
p::EXTENDED
の論理和を指定します。
Integer...
...false 以外)であれば
Regex
p::IGNORECASE の指定と同じになります。

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

//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(s...
...xp"

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.json_create(hash) -> Regexp (3106.0)

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

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

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

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

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

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

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

//emlist[][ruby]{
arr = [/a/, /b/, /c/]
p Regexp.union(arr) # => /(?-mix:a)|(?-mix:b)|(?-mix:c)/
# 1.8.7 より前は、以下のように書く必要があった
p Regexp.union(*arr) # =>...
...ドが固定されている Regexp とコードが固定されていない Regexp を混ぜた場合、
結果の Regexp は固定されているコードに対応するものになります。

//emlist[][ruby]{
p Regexp.union(/a/e, /b/) # => /(?-mix:a)|(?-mix:b)/e
//}

@
param pattern | で連結...

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

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

...# => ["oo"]
//}

@
param str 文字列を指定します。str との正規表現マッチを行います。

@
param pos 整数を指定します。マッチの開始位置を pos から行うよう制御できます(pos のデフォルト値は 0)。

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

i...
...に失敗した場合、
nil.captures を呼び出そうとして例外 NoMethodError が発生して
しまいます。

//emlist[例][ruby]{
foo, bar, baz = /(foo)(bar)(baz)/.match("foobar").captures

# => -:1: undefined method `captures' for nil:NilClass (NoMethodError)
//}

@
see Regexp#match?...

絞り込み条件を変える

Regexp#match(str, pos = 0) {|m| ... } -> object | nil (3018.0)

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

...# => ["oo"]
//}

@
param str 文字列を指定します。str との正規表現マッチを行います。

@
param pos 整数を指定します。マッチの開始位置を pos から行うよう制御できます(pos のデフォルト値は 0)。

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

i...
...に失敗した場合、
nil.captures を呼び出そうとして例外 NoMethodError が発生して
しまいます。

//emlist[例][ruby]{
foo, bar, baz = /(foo)(bar)(baz)/.match("foobar").captures

# => -:1: undefined method `captures' for nil:NilClass (NoMethodError)
//}

@
see Regexp#match?...

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

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

...

@
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 case

/\A[a-z]*\z/ === "HELLO" # => false
/\A[A-Z]*\z/ === "HELLO" # => true
//}

@
see En...
<< 1 2 3 ... > >>