るりまサーチ

最速Rubyリファレンスマニュアル検索!
33件ヒット [1-33件を表示] (0.052秒)
トップページ > クエリ:-[x] > クエリ:IGNORECASE[x] > クエリ:compile[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

種類

ライブラリ

クラス

キーワード

検索結果

Regexp.compile(string, option = nil, code = nil) -> Regexp (18249.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...
...= 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 (3149.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...
...= 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("ふる...

正規表現 (648.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]{
r = Regexp.compile(<<'__REGEXP__'.strip, Regexp::EXTENDED)
(?<element> \g<stag> \g<content>* \g<etag> ){0}
(?<stag> < \g<name> \s* > ){0}
(?<name> [a-zA-Z_:]+ ){0}
(?<content> [^<&]+ (\g<element> | [^<&]+)* ){0}
(?<etag> </ \k<name+...
...][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...