3件ヒット
[1-3件を表示]
(0.023秒)
種類
- 特異メソッド (2)
- インスタンスメソッド (1)
キーワード
- compile (1)
-
fixed
_ encoding? (1) - new (1)
検索結果
先頭3件
-
Regexp
# fixed _ encoding? -> bool (76.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
. compile(string , option = nil , code = nil) -> Regexp (28.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE......を出力します。
@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。
//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
p $~ # => "This is Regexp"
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::MULTILINE)
p t2.match(str)... -
Regexp
. new(string , option = nil , code = nil) -> Regexp (28.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE......を出力します。
@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。
//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
p $~ # => "This is Regexp"
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::MULTILINE)
p t2.match(str)...