種類
- インスタンスメソッド (225)
- 特異メソッド (108)
- 定数 (60)
ライブラリ
- ビルトイン (369)
-
json
/ add / regexp (24)
キーワード
- == (12)
- === (12)
- =~ (12)
- EXTENDED (12)
- FIXEDENCODING (12)
- IGNORECASE (12)
- MULTILINE (12)
- NOENCODING (12)
- casefold? (12)
- compile (12)
- encoding (12)
- eql? (12)
- escape (12)
-
fixed
_ encoding? (12) - hash (12)
- inspect (12)
-
json
_ create (12) -
last
_ match (24) - match (24)
- match? (9)
-
named
_ captures (12) - names (12)
- new (12)
- quote (12)
- source (12)
-
to
_ json (12) -
to
_ s (12) -
try
_ convert (12) - union (12)
- ~ (12)
検索結果
先頭5件
-
Regexp
# ==(other) -> bool (1.0) -
otherが同じパターン、オプション、文字コードの正規表現であったらtrueを返します。
...らtrueを返します。
@param other 正規表現を指定します。
//emlist[例][ruby]{
p /^eee$/ == /~eee$/x # => false
p /^eee$/ == /~eee$/i # => false
p /^eee$/e == /~eee$/u # => false
p /^eee$/ == Regexp.new("^eee$") # => true
p /^eee$/.eql?(/^eee$/) # => true
//}... -
Regexp
# ===(string) -> bool (1.0) -
文字列 string との正規表現マッチを行います。 マッチした場合は真を返します。
文字列 string との正規表現マッチを行います。
マッチした場合は真を返します。
string が文字列でもシンボルでもない場合には false を返します。
このメソッドは主にcase文での比較に用いられます。
@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 ... -
Regexp
# =~(string) -> Integer | nil (1.0) -
文字列 string との正規表現マッチを行います。マッチした場合、 マッチした位置のインデックスを返します(先頭は0)。マッチしなかった 場合、あるいは string が nil の場合には nil を返 します。
...す。
//emlist[例][ruby]{
p /foo/ =~ "foo" # => 0
p /foo/ =~ "afoo" # => 1
p /foo/ =~ "bar" # => nil
//}
組み込み変数 $~ もしくは Regexp.last_match にマッチに関する情報 MatchData が設定されます。
文字列のかわりにSymbolをマッチさせることができま......tring オブジェクト
でも Symbol でもない場合発生します。
//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/ === "b... -
Regexp
# casefold? -> bool (1.0) -
正規表現が大文字小文字の判定をしないようにコンパイルされている時、 真を返します。
...正規表現が大文字小文字の判定をしないようにコンパイルされている時、
真を返します。
//emlist[例][ruby]{
reg = Regexp.new("foobar", Regexp::IGNORECASE)
p reg.casefold? # => true
reg = Regexp.new("hogehoge")
p reg.casefold? # => false
//}... -
Regexp
# encoding -> Encoding (1.0) -
正規表現オブジェクトのエンコーディングを表す Encoding オブジェクト を返します。
...正規表現オブジェクトのエンコーディングを表す Encoding オブジェクト
を返します。
@see d:spec/regexp#encoding... -
Regexp
# eql?(other) -> bool (1.0) -
otherが同じパターン、オプション、文字コードの正規表現であったらtrueを返します。
...らtrueを返します。
@param other 正規表現を指定します。
//emlist[例][ruby]{
p /^eee$/ == /~eee$/x # => false
p /^eee$/ == /~eee$/i # => false
p /^eee$/e == /~eee$/u # => false
p /^eee$/ == Regexp.new("^eee$") # => true
p /^eee$/.eql?(/^eee$/) # => true
//}... -
Regexp
# fixed _ encoding? -> bool (1.0) -
正規表現が任意の ASCII 互換エンコーディングとマッチ可能な時に false を返します。
正規表現が任意の ASCII 互換エンコーディングとマッチ可能な時に false を返します。
//emlist[例][ruby]{
# -*- coding:utf-8 -*-
r = /a/
r.fixed_encoding? # => false
r.encoding # => #<Encoding:US-ASCII>
r =~ "\u{6666} a" # => 2
r =~ "\xa1\... -
Regexp
# hash -> Integer (1.0) -
正規表現のオプションやテキストに基づいたハッシュ値を返します。
正規表現のオプションやテキストに基づいたハッシュ値を返します。
//emlist[例][ruby]{
p /abc/i.hash # => 4893115
p /abc/.hash # => 4856055
//} -
Regexp
# inspect -> String (1.0) -
Regexp#to_s より自然な文字列を返します。
...Regexp#to_s より自然な文字列を返します。
//emlist[例][ruby]{
p /^ugou.*?/i.to_s # => "(?i-mx:^ugou.*?)"
p /^ugou.*?/i.inspect # => "/^ugou.*?/i"
//}
@see Regexp#to_s...