るりまサーチ

最速Rubyリファレンスマニュアル検索!
168件ヒット [101-168件を表示] (0.020秒)
トップページ > クエリ:regexp[x] > 種類:特異メソッド[x]

別のキーワード

  1. uri regexp
  2. _builtin regexp
  3. regexp match
  4. etc sc_regexp
  5. regexp last_match

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < 1 2 >>

Regexp.last_match -> MatchData (9042.0)

カレントスコープで最後に行った正規表現マッチの 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.escape(string) -> String (9007.0)

string の中で正規表現において特別な意味を持つ文字の直前にエ スケープ文字(バックスラッシュ)を挿入した文字列を返します。

...持つ文字の直前にエ
スケープ文字(バックスラッシュ)を挿入した文字列を返します。

@param string 正規表現において特別な意味をもつ文字をもつ文字列を指定します。

//emlist[例][ruby]{
rp = Regexp.escape("$bc^")
p rp # => "\\$bc\\^"
//}...

Regexp.quote(string) -> String (9007.0)

string の中で正規表現において特別な意味を持つ文字の直前にエ スケープ文字(バックスラッシュ)を挿入した文字列を返します。

...持つ文字の直前にエ
スケープ文字(バックスラッシュ)を挿入した文字列を返します。

@param string 正規表現において特別な意味をもつ文字をもつ文字列を指定します。

//emlist[例][ruby]{
rp = Regexp.escape("$bc^")
p rp # => "\\$bc\\^"
//}...

RDoc::Parser.parsers -> [[Regexp, RDoc::Parser]] (102.0)

RDoc::Parser#parse_files_matching で登録した正規表現とパーサクラ スの配列の配列を返します。

RDoc::Parser#parse_files_matching で登録した正規表現とパーサクラ
スの配列の配列を返します。

OptionParser.accept(klass, pat = /.*/) {|str| ...} -> () (7.0)

オプションの引数を文字列から Ruby のオブジェクトに変換するための ブロックを登録します。すべての OptionParser インスタンスに共通です。

...しては変換用のブロックがデフォルトで登録されて
います。OptionParser#on を参照して下さい。

@param klass クラスオブジェクトを与えます。

@param pat match メソッドを持ったオブジェクト(Regexp オブジェクトなど)を与えます。...

絞り込み条件を変える

Readline.completion_proc=(proc) (7.0)

ユーザからの入力を補完する時の候補を取得する Proc オブジェクト proc を指定します。 proc は、次のものを想定しています。 (1) callメソッドを持つ。callメソッドを持たない場合、例外 ArgumentError を発生します。 (2) 引数にユーザからの入力文字列を取る。 (3) 候補の文字列の配列を返す。

...

例: foo、foobar、foobazを補完する。

require 'readline'

WORDS = %w(foo foobar foobaz)

Readline.completion_proc = proc {|word|
WORDS.grep(/\A#{Regexp.quote word}/)
}

while buf = Readline.readline("> ")
print "-> ", buf, "\n"
end

@see Readline.completion_proc...
<< < 1 2 >>