ライブラリ
- ビルトイン (346)
- ipaddr (11)
- openssl (110)
-
rdoc
/ markup (11) -
rdoc
/ markup / formatter (11) -
rdoc
/ text (11) -
rubygems
/ dependency (11) -
rubygems
/ platform (11) -
rubygems
/ requirement (11) - stringio (11)
- tmpdir (33)
- win32ole (33)
- zlib (11)
クラス
- Bignum (3)
- Dir (44)
- File (20)
- Fixnum (3)
-
Gem
:: Dependency (11) -
Gem
:: Platform (11) -
Gem
:: Requirement (11) - IPAddr (11)
- Integer (11)
- NilClass (6)
- Object (20)
-
RDoc
:: Markup :: Formatter (11) - Regexp (22)
- String (41)
- StringIO (11)
- Symbol (11)
- WIN32OLE (33)
-
Zlib
:: GzipWriter (11)
モジュール
- Kernel (176)
-
OpenSSL
:: SSL (110) - Process (11)
-
RDoc
:: Text (11)
キーワード
- !~ (11)
-
$ ~ (11) - % (11)
- =~ (81)
- Markup (11)
- Marshal フォーマット (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 7 . 0 (5) - Numeric (11)
-
OP
_ DONT _ INSERT _ EMPTY _ FRAGMENTS (11) -
OP
_ MICROSOFT _ BIG _ SSLV3 _ BUFFER (11) -
OP
_ MICROSOFT _ SESS _ ID _ BUG (11) -
OP
_ MSIE _ SSLV2 _ RSA _ PADDING (11) -
OP
_ NETSCAPE _ CHALLENGE _ BUG (11) -
OP
_ NETSCAPE _ REUSE _ CIPHER _ CHANGE _ BUG (11) -
OP
_ SSLEAY _ 080 _ CLIENT _ DH _ BUG (11) -
OP
_ SSLREF2 _ REUSE _ CERT _ TYPE _ BUG (11) -
OP
_ TLS _ BLOCK _ PADDING _ BUG (11) -
OP
_ TLS _ D5 _ BUG (11) - Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
-
add
_ tag (11) -
create
_ guid (11) - downcase (8)
- exec (55)
- format (11)
- irb (11)
- locale (11)
- locale= (11)
- mkdir (11)
- mkfifo (9)
- mktmpdir (22)
- putc (33)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 4 feature (11) - spawn (44)
- sprintf (11)
- sprintf フォーマット (11)
-
strip
_ stars (11) - system (44)
- tmpdir (11)
-
to
_ i (11) - xmlrpc (3)
- 演算子式 (11)
検索結果
先頭5件
-
Bignum
# ~ -> Fixnum | Bignum (18225.0) -
ビット演算子。否定を計算します。
...ビット演算子。否定を計算します。
~1 #=> -2
~3 #=> -4
~-4 #=> 3... -
Fixnum
# ~ -> Fixnum | Bignum (18225.0) -
ビット演算子。否定を計算します。
...ビット演算子。否定を計算します。
~1 #=> -2
~3 #=> -4
~-4 #=> 3... -
Integer
# ~ -> Integer (18225.0) -
ビット演算子。否定を計算します。
...ビット演算子。否定を計算します。
//emlist[][ruby]{
~1 # => -2
~3 # => -4
~-4 # => 3
//}... -
Regexp
# ~ -> Integer | nil (18207.0) -
変数 $_ の値との間でのマッチをとります。
...意味です。
//emlist[][ruby]{
self =~ $_
//}
//emlist[例][ruby]{
$_ = "hogehoge"
if /foo/
puts "match"
else
puts "no match"
end
# => no match
# ただし、警告がでる。warning: regex literal in condition
reg = Regexp.compile("foo")
if ~ reg
puts "match"
else
puts "no match"... -
IPAddr
# ~ -> IPAddr (18201.0) -
ビットごとの論理否定により、新しい IPAddr オブジェクトを生成します。
ビットごとの論理否定により、新しい IPAddr オブジェクトを生成します。 -
Gem
:: Dependency # =~(other) -> bool (6200.0) -
self と other を比較して真偽値を返します。
self と other を比較して真偽値を返します。
self の Gem::Dependency#name が正規表現として other とマッチしない場合は偽を返します。
self が other との依存関係を満たしていれば真を返します。満たしていなければ偽を返します。 -
Gem
:: Platform # =~(other) -> bool (6200.0) -
自身と other のプラットフォームが一致する場合に真を返します。 そうでない場合は、偽を返します。
自身と other のプラットフォームが一致する場合に真を返します。
そうでない場合は、偽を返します。
other が文字列の場合は、まず Gem::Platform に変換してから比較を行います。
other が文字列でも Gem::Platform でもない場合は nil を返します。
@param other 比較対象のオブジェクトです。
@see Gem::Platform#=== -
Kernel
$ $ ~ -> MatchData | nil (6200.0) -
現在のスコープで最後に成功したマッチに関する MatchDataオブジェクトです。 Regexp.last_match の別名です。
...tchDataオブジェクトです。
Regexp.last_match の別名です。
このデータから n 番目のマッチ ($n) を取り出すためには $~[n] を使います。
この値に代入すると Regexp.last_match や、 $&, $1, $2, ... などの関連する組み込み変数の値が変化......ます。
この変数はローカルスコープかつスレッドローカルです。
Ruby起動時の初期値は nil です。
//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
p $~[1]
end
#=> "http://example.com"
//}... -
NilClass
# =~(other) -> nil (6200.0) -
右辺に正規表現オブジェクトを置いた正規表現マッチ obj =~ /RE/ をサポートするためのメソッドです。常に nil を返します。
...現マッチ obj =~ /RE/
をサポートするためのメソッドです。常に nil を返します。
@param other 任意のオブジェクトです。結果に影響しません。
//emlist[例][ruby]{
obj = 'regexp'
p(obj =~ /re/) #=> 0
obj = nil
p(obj =~ /re/) #=> nil
//}
@see String#=~... -
Object
# !~(other) -> bool (6200.0) -
自身が other とマッチしない事を判定します。
...身が other とマッチしない事を判定します。
self#=~(obj) を反転した結果と同じ結果を返します。
@param other 判定するオブジェクトを指定します。
//emlist[例][ruby]{
obj = 'regexp'
p (obj !~ /re/) # => false
obj = nil
p (obj !~ /re/) # => true
//}... -
Object
# =~(other) -> nil (6200.0) -
右辺に正規表現オブジェクトを置いた正規表現マッチ obj =~ /RE/ をサポートするためのメソッドです。常に nil を返します。
...表現オブジェクトを置いた正規表現マッチ obj =~ /RE/
をサポートするためのメソッドです。常に nil を返します。
このメソッドは Ruby 2.6 から deprecated です。
この定義により、=~ が再定義されたオブジェクトでは正常にマッ......チを行い、
それ以外のものは nil を返すようになります。
@param other 任意のオブジェクトです。結果に影響しません。
//emlist[例][ruby]{
obj = 'regexp'
p(obj =~ /re/) #=> 0
obj = nil
p(obj =~ /re/) #=> nil
//}
@see String#=~......ッチ obj =~ /RE/
をサポートするためのメソッドです。常に nil を返します。
このメソッドは Ruby 2.6 から deprecated です。
意図せずに Array などに対して呼ばれた時にバグの原因になっていたため、
代わりに NilClass#=~ が定義さ......れています。
@param other 任意のオブジェクトです。結果に影響しません。
//emlist[例][ruby]{
obj = 'regexp'
p(obj =~ /re/) #=> 0
obj = nil
p(obj =~ /re/) #=> nil
//}
@see String#=~... -
Regexp
# =~(string) -> Integer | nil (6200.0) -
文字列 string との正規表現マッチを行います。マッチした場合、 マッチした位置のインデックスを返します(先頭は0)。マッチしなかった 場合、あるいは string が nil の場合には nil を返 します。
...、あるいは string が nil の場合には nil を返
します。
//emlist[例][ruby]{
p /foo/ =~ "foo" # => 0
p /foo/ =~ "afoo" # => 1
p /foo/ =~ "bar" # => nil
//}
組み込み変数 $~ もしくは Regexp.last_match にマッチに関する情報 MatchData が設定されます。
文......emlist[例][ruby]{
p /foo/ =~ "foo" # => 0
p Regexp.last_match(0) # => "foo"
p /foo/ =~ "afoo" # => 1
p $~[0] # => "foo"
p /foo/ =~ "bar" # => nil
unless /foo/ === "bar"
puts "not match " # => not match
end
str = []
begin
/ugo/ =~ str
rescue TypeError
pri...