種類
- インスタンスメソッド (414)
- 特異メソッド (120)
- 変数 (24)
- 定数 (18)
- 文書 (12)
ライブラリ
- ビルトイン (387)
-
json
/ add / regexp (24) -
minitest
/ spec (2) -
minitest
/ unit (1) -
rdoc
/ parser (12) - scanf (6)
- strscan (120)
- uri (24)
クラス
- Module (1)
- Object (1)
-
RDoc
:: Parser (12) - Regexp (237)
-
Scanf
:: FormatString (6) - String (117)
- StringScanner (120)
- Symbol (33)
モジュール
- Kernel (24)
-
MiniTest
:: Assertions (1) - URI (24)
キーワード
-
$ -F (12) -
$ ; (12) - == (12)
- === (12)
- =~ (12)
- FIXEDENCODING (12)
- [] (36)
- []= (36)
-
assert
_ match (1) - check (12)
-
check
_ until (12) - compile (12)
- encoding (12)
- eql? (12)
- escape (12)
- exist? (12)
-
infect
_ with _ assertions (1) - inspect (12)
-
json
_ create (12) -
last
_ match (24) - match (48)
- match? (39)
-
must
_ match (1) - new (12)
-
parse
_ files _ matching (12) - quote (12)
- regexp (24)
-
ruby 1
. 8 . 4 feature (12) - scan (12)
-
scan
_ full (12) -
scan
_ until (12) -
search
_ full (12) - skip (12)
-
skip
_ until (12) - slice (36)
-
to
_ json (12) -
to
_ s (12) - union (12)
検索結果
先頭5件
-
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,
Regexp::EXTENDED
の論理和を指定します。
Integer......れば
Regexp::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,
Regexp::EXTENDED
の論理和を指定します。
Integer......れば
Regexp::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,
Regexp::EXTENDED
の論理和を指定します。
Integer......false 以外)であれば
Regexp::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,
Regexp::EXTENDED
の論理和を指定します。
Integer......false 以外)であれば
Regexp::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...