5件ヒット
[1-5件を表示]
(0.128秒)
ライブラリ
- ビルトイン (5)
キーワード
- == (1)
- eql? (1)
-
fixed
_ encoding? (1) -
named
_ captures (1) - source (1)
検索結果
先頭5件
-
Regexp
# named _ captures -> { String => [Integer] } (18307.0) -
正規表現に含まれる名前付きキャプチャ(named capture)の情報を Hash で返します。
正規表現に含まれる名前付きキャプチャ(named capture)の情報を
Hash で返します。
Hash のキーは名前付きキャプチャの名前で、値は
その名前に関連付けられたキャプチャの index のリストを返します。
//emlist[例][ruby]{
/(?<foo>.)(?<bar>.)/.named_captures
# => {"foo"=>[1], "bar"=>[2]}
/(?<foo>.)(?<foo>.)/.named_captures
# => {"foo"=>[1, 2]}
# 名前付きキャプチャを持たないときは空の Hash を返します。
/(.)(.)/... -
Regexp
# source -> String (18307.0) -
その正規表現のもととなった文字列表現を生成して返します。
その正規表現のもととなった文字列表現を生成して返します。
//emlist[例][ruby]{
re = /foo|bar|baz/i
p re.source # => "foo|bar|baz"
//} -
Regexp
# fixed _ encoding? -> bool (97.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
# ==(other) -> bool (25.0) -
otherが同じパターン、オプション、文字コードの正規表現であったらtrueを返します。
...らtrueを返します。
@param other 正規表現を指定します。
//emlist[例][ruby]{
p /^eee$/ == /~eee$/x # => false
p /^eee$/ == /~eee$/i # => false
p /^eee$/e == /~eee$/u # => false
p /^eee$/ == Regexp.new("^eee$") # => true
p /^eee$/.eql?(/^eee$/) # => true
//}... -
Regexp
# eql?(other) -> bool (25.0) -
otherが同じパターン、オプション、文字コードの正規表現であったらtrueを返します。
...らtrueを返します。
@param other 正規表現を指定します。
//emlist[例][ruby]{
p /^eee$/ == /~eee$/x # => false
p /^eee$/ == /~eee$/i # => false
p /^eee$/e == /~eee$/u # => false
p /^eee$/ == Regexp.new("^eee$") # => true
p /^eee$/.eql?(/^eee$/) # => true
//}...