るりまサーチ

最速Rubyリファレンスマニュアル検索!
101件ヒット [1-100件を表示] (0.094秒)

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. csv to_i
  5. matrix i

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Kernel$$~ -> MatchData | nil (18201.0)

現在のスコープで最後に成功したマッチに関する MatchDataオブジェクトです。 Regexp.last_match の別名です。

...目のマッチ ($n) を取り出すためには $~[n] を使います。

この値に代入すると Regexp.last_match や、 $&, $1, $2, ... などの関連する組み込み変数の値が変化します。
MatchData オブジェクトでも nil でもない値を代入しようとすると Type...
...ます。

この変数はローカルスコープかつスレッドローカルです。
Ruby起動時の初期値は nil です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
i
f %r[<a href="(.*?)">(.*?)</a>] =~ str
p $~[1]
end
#=> "http://example.com"
//}...

String#byterindex(pattern, offset = self.bytesize) -> Integer | nil (9218.0)

文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。

...す。
見つからなければ nil を返します。

引数 pattern は探索する部分文字列または正規表現で指定します。

offset が負の場合は、文字列の末尾から数えた位置から探索します。

byterindex と String#byteindex とでは、探索方向だけ...
...mlist[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}

//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex("in...
...terindex('f') # => 0
'foo'.byterindex('o') # => 2
'foo'.byterindex('oo') # => 1
'foo'.byterindex('ooo') # => nil

'foo'.byterindex(/f/) # => 0
'foo'.byterindex(/o/) # => 2
'foo'.byterindex(/oo/) # => 1
'foo'.byterindex(/ooo/) # => nil

# 右でのマッチが優先
'foo'.byterindex(/o+/) # => 2
$~
#...

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

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

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

第一引数が正規表現であれば第一引数を複製して返します。第二、第三引数は警告の上無視されます。

@param string 正規表現を文字列として与えま...
...@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
I
nteger 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE...
...BIT になります。
それ以外の指定は警告を出力します。

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

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

static void special_local_set(char c, VALUE val) (6132.0)

$~ と $_ をセットします。 現在は c=0 が $_ で c=1 が $~ です。

...
$~
と $_ をセットします。
現在は c=0 が $_ で c=1 が $~ です。...

StringScanner (6006.0)

StringScanner は文字列スキャナクラスです。 簡単に高速なスキャナを記述できます。

...StringScanner は文字列スキャナクラスです。
簡単に高速なスキャナを記述できます。

//emlist[例][ruby]{
require 'strscan'

s = StringScanner.new('This is an example string')
s.eos? #=> false

p s.scan(/\w+/) #=> "This"
p s.scan(/\w+/) #=> nil
p s.scan(/\s...
...+/) #=> nil
p s.scan(/\w+/) #=> "is"
s.eos? #=> false

p s.scan(/\s+/) #=> " "
p s.scan(/\w+/) #=> "an"
p s.scan(/\s+/) #=> " "
p s.scan(/\w+/) #=> "example"
p s.scan(/\s+/) #=> " "
p s.scan(/\w+/) #=> "string"
s.eos? #=> true

p s.scan(/\s+/) #=> nil
p s.scan...
...ます。

//emlist[例:][ruby]{
# 次の行以降の内容を EUC-JP として保存して試してください
# vim:set fileencoding=euc-jp:
require 'strscan'
s = StringScanner.new("るびい") # 文字コードはEUC-JPとします
p s.exist?(/び/) #=> 4
//}

StringScanner は $~ $& $1 $2 …...

絞り込み条件を変える

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

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

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

第一引数が正規表現であれば第一引数を複製して返します。第二、第三引数は警告の上無視されます。

@param string 正規表現を文字列として与えま...
...@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
I
nteger 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE...
...BIT になります。
それ以外の指定は警告を出力します。

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

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

ruby 1.6 feature (1116.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...ruby 1.6 feature
ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン
になります。

((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。

== 1.6.8 (2002-12-24) ->...
...EAGAIN と EWOULDBLOCK が同じ値のシステムで、EWOULDBLOCK がなくなっ
ていました。現在は、このようなシステムでは、EWOULDBLOCK は、EAGAIN
として定義されています。(これは 1.6.7 とは異なる挙動です)

p Errno::EAGAIN...
...) {|f| p f }

=> -:1:in `step': step cannot be 0 (ArgumentError)
from -:1
ruby 1.6.7 (2002-03-01) [i586-linux]

=> ruby 1.6.7 (2002-04-10) [i586-linux]
1
1.1
:
1.9

: 2002-04-01: ((<組み込み変数/$~>))

$~
に nil を代入できない...

VALUE rb_backref_get(void) (116.0)

現在の SCOPE の $~ の値を返します。

...現在の SCOPE の $~ の値を返します。...

void rb_backref_set(VALUE val) (116.0)

現在の SCOPE の $~ に val を代入します。

...現在の SCOPE の $~ に val を代入します。...

MatchData#to_s -> String (106.0)

マッチした文字列全体を返します。

...マッチした文字列全体を返します。

//emlist[例][ruby]{
/bar/ =~ "foobarbaz"
p $~ # => #<MatchData:0x401b1be4>
p $~.to_s # => "bar"
//}...

絞り込み条件を変える

<< 1 2 > >>