るりまサーチ (Ruby 2.5.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.018秒)
トップページ > クラス:Regexp[x] > クエリ:EXTENDED[x] > クエリ:compile[x] > バージョン:2.5.0[x]

別のキーワード

  1. _builtin extended
  2. mutex_m mu_extended
  3. module extended
  4. regexp extended
  5. historysavingability extended

ライブラリ

検索結果

Regexp.compile(string, option = nil, code = nil) -> Regexp (54397.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 (9097.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)...