種類
- インスタンスメソッド (22)
- 特異メソッド (22)
- 変数 (11)
- 文書 (11)
- 定数 (11)
クラス
- Regexp (55)
モジュール
- Kernel (11)
キーワード
-
$ IGNORECASE (11) - casefold? (11)
- compile (11)
- new (11)
- 正規表現 (11)
検索結果
先頭5件
-
Regexp
:: IGNORECASE -> Integer (18201.0) -
文字の大小の違いを無視します。 正規表現リテラルの //i オプションと同じです。
文字の大小の違いを無視します。
正規表現リテラルの //i オプションと同じです。 -
Kernel
$ $ IGNORECASE -> bool (6213.0) -
過去との互換性のために残されていますが、もはや何の意味もありません。
...りません。
値は常に false です。代入しても無視されます。
$= の別名
require "English"
$IGNORECASE = true # => warning: variable $= is no longer effective; ignored
$IGNORECASE # => warning: variable $= is no longer effective
# false... -
正規表現 (642.0)
-
正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references
...るよう
になる場合があります。つまりメタ文字列を構成します。例えば
//emlist[][ruby]{
/[a-z]/
/\Axyz\Z/
//}
という正規表現において "[a-z]", "\A", "\Z"はメタ文字列です。
===[a:expansion] 式展開
正規表現内では、#{式} という形式で......タ文字が含まれているならば、それは
メタ文字として認識されます。
//emlist[][ruby]{
number = "(\\d+)"
operator = "(\\+|-|\\*|/)"
/#{number}#{operator}#{number}/.match("43+291")
# => #<MatchData "43+291" 1:"43" 2:"+" 3:"291">
//}
埋め込む文字列をリテラルと......][ruby]{
Regexp.new("abc", Regexp::IGNORECASE) # => /abc/i
Regexp.new("abc", Regexp::MULTILINE) # => /abc/m
Regexp.new("abc # Comment", Regexp::EXTENDED) # => /abc # Comment/x
Regexp.new("abc", Regexp::IGNORECASE | Regexp::MULTILINE) # => /abc/mi... -
Regexp
# options -> Integer (146.0) -
正規表現の生成時に指定されたオプションを返します。戻り値は、 Regexp::EXTENDED, Regexp::IGNORECASE, Regexp::MULTILINE, Regexp::FIXEDENCODING, Regexp::NOENCODING, の論理和です。
...正規表現の生成時に指定されたオプションを返します。戻り値は、
Regexp::EXTENDED, Regexp::IGNORECASE,
Regexp::MULTILINE,
Regexp::FIXEDENCODING,
Regexp::NOENCODING,
の論理和です。
これで得られるオプションには生成時に指定したもの以外の
オ......視されます。
//emlist[例][ruby]{
p Regexp::IGNORECASE # => 1
p //i.options # => 1
p Regexp.new("foo", Regexp::IGNORECASE ).options # => 1
p Regexp.new("foo", Regexp::EXTENDED).options # => 2
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::EXTENDED).options # => 3
p Regexp.new("fo......o", Regexp::MULTILINE).options # => 4
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::MULTILINE ).options # => 5
p Regexp.new("foo", Regexp::MULTILINE | Regexp::EXTENDED).options # =>6
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::MULTILINE | Regexp::EXTENDED).options # => 7
//}... -
Regexp
. compile(string , option = nil , code = nil) -> Regexp (130.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...tion Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE の指定と......は ASCII-8BIT になります。
それ以外の指定は警告を出力します。
@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。
//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match......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 , code = nil) -> Regexp (130.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...tion Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE の指定と......は ASCII-8BIT になります。
それ以外の指定は警告を出力します。
@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。
//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match......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
# casefold? -> bool (106.0) -
正規表現が大文字小文字の判定をしないようにコンパイルされている時、 真を返します。
...正規表現が大文字小文字の判定をしないようにコンパイルされている時、
真を返します。
//emlist[例][ruby]{
reg = Regexp.new("foobar", Regexp::IGNORECASE)
p reg.casefold? # => true
reg = Regexp.new("hogehoge")
p reg.casefold? # => false
//}...