34件ヒット
[1-34件を表示]
(0.019秒)
検索結果
先頭3件
-
Regexp
. compile(string , option = nil , code = nil) -> Regexp (18125.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...ンコーディングは ASCII-8BIT になります。
それ以外の指定は警告を出力します。
@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。
//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp:......= 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 (3025.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...ンコーディングは ASCII-8BIT になります。
それ以外の指定は警告を出力します。
@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。
//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp:......= 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("ふる... -
正規表現 (84.0)
-
正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references
...[0-9]
* \D 非10進数字 [^0-9]
* \h 16進数字 [0-9a-fA-F]
* \H 非16進数字 [^0-9a-fA-F]
これらの「空白」「数字」などは ASCII の範囲の文字のみを対象としています。
いわゆる「全角アルファベット」「全角空白」「全角数字」などは......ドポイントで示されています。
* [:alnum:] 英数字 (Letter | Mark | Decimal_Number)
* [:alpha:] 英字 (Letter | Mark)
* [:ascii:] ASCIIに含まれる文字 (0000 - 007F)
* [:blank:] スペースとタブ (Space_Separator | 0009)
* [:cntrl:] 制御文字 (Control | Format |......ker" a:"rekxker" b:"k">
//}
以下の例では、開始タグと終了タグを対応付ける正規表現です。
//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}...