33件ヒット
[1-33件を表示]
(0.085秒)
検索結果
先頭3件
-
RegexpError (46020.0)
-
正規表現のコンパイルに失敗したときに発生します。
...正規表現のコンパイルに失敗したときに発生します。
例:
$ ruby -e 'Regexp.compile("*")'
-e:1:in `initialize': target of repeat operator is not specified: /*/ (RegexpError)
from -e:1:in `Regexp#compile'
from -e:1... -
Regexp
. compile(string , option = nil , code = nil) -> Regexp (26127.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...出力します。
@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 # ここ......使用されない
', 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)[0] # => "ふるいけや\nかわずと"
//}... -
Regexp
. new(string , option = nil , code = nil) -> Regexp (11027.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...出力します。
@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 # ここ......使用されない
', 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)[0] # => "ふるいけや\nかわずと"
//}...