検索結果
先頭5件
-
Regexp
:: IGNORECASE -> Fixnum (18102) -
文字の大小の違いを無視します。 正規表現リテラルの //i オプションと同じです。
文字の大小の違いを無視します。
正規表現リテラルの //i オプションと同じです。 -
Regexp
# options -> Integer (47) -
正規表現の生成時に指定されたオプションを返します。戻り値は、 Regexp::EXTENDED, Regexp::IGNORECASE, Regexp::MULTILINE, Regexp::FIXEDENCODING, Regexp::NOENCODING, の論理和です。
...
Regexp::EXTENDED, Regexp::IGNORECASE,
Regexp::MULTILINE,
の論理和です。
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 |......tions #=> 3
p Regexp.new("foo", 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).op......正規表現の生成時に指定されたオプションを返します。戻り値は、
Regexp::EXTENDED, Regexp::IGNORECASE,
Regexp::MULTILINE,
Regexp::FIXEDENCODING,
の論理和です。
これで得られるオプションには生成時に指定したもの以外の
オプションを含......で、Regexp.new にこれらを
渡しても無視されます。
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::EXTEND......正規表現の生成時に指定されたオプションを返します。戻り値は、
Regexp::EXTENDED, Regexp::IGNORECASE,
Regexp::MULTILINE,
Regexp::FIXEDENCODING,
Regexp::NOENCODING,
の論理和です。
これで得られるオプションには生成時に指定したもの以外の
オ... -
Regexp
. compile(string , option = nil , code = nil) -> Regexp (25) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...m option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Fixnum 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE の指...... RegexpError 正規表現のコンパイルに失敗した場合発生します。
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
puts $~ #=> This is Regexp
t2 = Regexp.compile('
this # ここは使用されない
\ is
\ regexp......# ここも使用されない
', Regexp::EXTENDED | Regexp::IGNORECASE)
t2.match(str)
puts Regexp.last_match #=> This is Regexp
str = "ふるいけや\nかわずとびこむ\nみずのおと"
t2 = Regexp.compile("ふる.*?と", Regexp::MULTILINE)
puts t2.match(str)[0] #=> ふる... -
Regexp
. new(string , option = nil , code = nil) -> Regexp (25) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...m option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Fixnum 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE の指...... RegexpError 正規表現のコンパイルに失敗した場合発生します。
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
puts $~ #=> This is Regexp
t2 = Regexp.compile('
this # ここは使用されない
\ is
\ regexp......# ここも使用されない
', Regexp::EXTENDED | Regexp::IGNORECASE)
t2.match(str)
puts Regexp.last_match #=> This is Regexp
str = "ふるいけや\nかわずとびこむ\nみずのおと"
t2 = Regexp.compile("ふる.*?と", Regexp::MULTILINE)
puts t2.match(str)[0] #=> ふる... -
Regexp
# casefold? -> bool (7) -
正規表現が大文字小文字の判定をしないようにコンパイルされている時、 真を返します。
...小文字の判定をしないようにコンパイルされている時、
真を返します。
reg = Regexp.new("foobar", Regexp::IGNORECASE)
p reg.casefold? #=> true
reg = Regexp.new("hogehoge")
p reg.casefold? #=> false...
