るりまサーチ

最速Rubyリファレンスマニュアル検索!
19件ヒット [1-19件を表示] (0.064秒)

別のキーワード

  1. string []=
  2. string slice
  3. string slice!
  4. string []
  5. string gsub

ライブラリ

キーワード

検索結果

Symbol#match(other) -> MatchData | nil (18251.0)

正規表現 other とのマッチを行います。

....match(other) と同じです。)

@param other 比較対象のシンボルを指定します。

@return マッチが成功すれば MatchData オブジェクトを、そうでなければ nil を返します。

p :foo.match(/foo/) # => #<MatchData "foo">
p :foobar.match(/bar/) # => #<Match...
...Data "bar">
p :foo.match(/bar/) # => nil

@see String#match
@see Symbol#match?...

Symbol#match(other) -> Integer | nil (18145.0)

正規表現 other とのマッチを行います。

...elf.to_s.match(other) と同じです。)

@param other 比較対象のシンボルを指定します。

@return マッチが成功すればマッチした位置を、そうでなければ nil を返します。

p :foo.match(/foo/) # => 0
p :foobar.match(/bar/) # => 3
p :foo.match(/bar/)...
...# => nil

@see String#match...

Symbol#match?(regexp, pos = 0) -> bool (6189.0)

regexp.match?(self, pos) と同じです。 regexp が文字列の場合は、正規表現にコンパイルします。 詳しくは Regexp#match? を参照してください。

...regexp.match?(self, pos) と同じです。
regexp が文字列の場合は、正規表現にコンパイルします。
詳しくは Regexp#match? を参照してください。

例:

:Ruby.match?(/R.../) # => true
:Ruby.match?('Ruby') # => true
:Ruby.match?('Ruby',1) # => false
:R...
...uby.match?('uby',1) # => true
:Ruby.match?(/P.../) # => false
$& # => nil

@see Regexp#match?, String#match?...