ライブラリ
- ビルトイン (224)
-
irb
/ cmd / help (12) -
net
/ telnet (8) - pathname (12)
-
rubygems
/ gem _ path _ searcher (12) - scanf (30)
- strscan (84)
クラス
-
Gem
:: GemPathSearcher (12) -
IRB
:: ExtendCommand :: Help (12) - MatchData (110)
-
Net
:: Telnet (8) - Pathname (12)
- Regexp (12)
-
Scanf
:: FormatSpecifier (6) -
Scanf
:: FormatString (24) - String (81)
- StringScanner (84)
- Symbol (21)
キーワード
- =~ (12)
- [] (48)
- captures (12)
-
check
_ until (12) - cmd (4)
- deconstruct (2)
- execute (12)
- gsub (12)
- gsub! (12)
-
last
_ match _ tried (6) - match? (30)
-
matched
_ count (6) -
matched
_ string (6) - matchedsize (12)
-
matching
_ files (12) -
post
_ match (12) -
pre
_ match (12) - prune (6)
-
scan
_ full (12) -
scan
_ until (12) -
skip
_ until (12) - sub (24)
- sub! (12)
-
to
_ a (12) - unscan (12)
-
values
_ at (12) - waitfor (4)
検索結果
先頭5件
-
String
# match(regexp , pos = 0) -> MatchData | nil (33519.0) -
regexp.match(self, pos) と同じです。 regexp が文字列の場合は、正規表現にコンパイルします。 詳しくは Regexp#match を参照してください。
...regexp.match(self, pos) と同じです。
regexp が文字列の場合は、正規表現にコンパイルします。
詳しくは Regexp#match を参照してください。
//emlist[例: regexp のみの場合][ruby]{
'hello'.match('(.)\1') # => #<MatchData "ll" 1:"l">
'hello'.match('(.)\1......"ll"
'hello'.match(/(.)\1/)[0] # => "ll"
'hello'.match('xx') # => nil
//}
//emlist[例: regexp, pos を指定した場合][ruby]{
'hoge hige hege bar'.match('h.ge', 0) # => #<MatchData "hoge">
'hoge hige hege bar'.match('h.ge', 1) # => #<MatchData "hige">
//}
//emlist[例: ブロ......ックを指定した場合][ruby]{
'hello'.match('(.)\1'){|e|"match #{$1}"} # => "match l"
'hello'.match('xx'){|e|"match #{$1}"} # マッチしないためブロックは実行されない
//}
@see Regexp#match, Symbol#match... -
String
# match(regexp , pos = 0) {|m| . . . } -> object (33319.0) -
regexp.match(self, pos) と同じです。 regexp が文字列の場合は、正規表現にコンパイルします。 詳しくは Regexp#match を参照してください。
...regexp.match(self, pos) と同じです。
regexp が文字列の場合は、正規表現にコンパイルします。
詳しくは Regexp#match を参照してください。
//emlist[例: regexp のみの場合][ruby]{
'hello'.match('(.)\1') # => #<MatchData "ll" 1:"l">
'hello'.match('(.)\1......"ll"
'hello'.match(/(.)\1/)[0] # => "ll"
'hello'.match('xx') # => nil
//}
//emlist[例: regexp, pos を指定した場合][ruby]{
'hoge hige hege bar'.match('h.ge', 0) # => #<MatchData "hoge">
'hoge hige hege bar'.match('h.ge', 1) # => #<MatchData "hige">
//}
//emlist[例: ブロ......ックを指定した場合][ruby]{
'hello'.match('(.)\1'){|e|"match #{$1}"} # => "match l"
'hello'.match('xx'){|e|"match #{$1}"} # マッチしないためブロックは実行されない
//}
@see Regexp#match, Symbol#match... -
Scanf
:: FormatString # match(str) (27218.0) -
@todo
...@todo... -
Symbol
# match(other) -> MatchData | nil (24468.0) -
正規表現 other とのマッチを行います。
...other とのマッチを行います。
(self.to_s.match(other) と同じです。)
@param other 比較対象のシンボルを指定します。
@return マッチが成功すれば MatchData オブジェクトを、そうでなければ nil を返します。
p :foo.match(/foo/) # => #<Mat......chData "foo">
p :foobar.match(/bar/) # => #<MatchData "bar">
p :foo.match(/bar/) # => nil
@see String#match
@see Symbol#match?... -
Symbol
# match(other) -> Integer | nil (24256.0) -
正規表現 other とのマッチを行います。
...正規表現 other とのマッチを行います。
(self.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... -
String
# match?(regexp , pos = 0) -> bool (21270.0) -
regexp.match?(self, pos) と同じです。 regexp が文字列の場合は、正規表現にコンパイルします。 詳しくは Regexp#match? を参照してください。
...regexp.match?(self, pos) と同じです。
regexp が文字列の場合は、正規表現にコンパイルします。
詳しくは Regexp#match? を参照してください。
//emlist[例][ruby]{
"Ruby".match?(/R.../) #=> true
"Ruby".match?(/R.../, 1) #=> false
"Ruby".match?(/P.../) #=>......false
$& #=> nil
//}
@see Regexp#match?, Symbol#match?... -
MatchData
# post _ match -> String (18321.0) -
マッチした部分より後ろの文字列を返します($'と同じ)。
...マッチした部分より後ろの文字列を返します($'と同じ)。
//emlist[例][ruby]{
/(bar)(BAZ)?/ =~ "foobarbaz"
p $~.post_match # => "baz"
//}
@see MatchData#pre_match... -
MatchData
# pre _ match -> String (18321.0) -
マッチした部分より前の文字列を返します($`と同じ)。
...マッチした部分より前の文字列を返します($`と同じ)。
//emlist[例][ruby]{
/(bar)(BAZ)?/ =~ "foobarbaz"
p $~.pre_match # => "foo"
//}
@see MatchData#post_match... -
Scanf
:: FormatSpecifier # matched _ string (18318.0) -
@todo
...@todo... -
StringScanner
# match?(regexp) -> Integer | nil (15238.0) -
スキャンポインタの地点だけで regexp と文字列のマッチを試します。 マッチしたら、スキャンポインタは進めずにマッチした 部分文字列の長さを返します。マッチしなかったら nil を 返します。
...//emlist[][ruby]{
require 'strscan'
def case1(encode)
utf8 = "\u{308B 3073 3044}"
s = StringScanner.new(utf8.encode(encode))
s.match?(/#{"\u{308B}".encode(encode)}/)
end
p case1("EUC-JP") #=> 2
//}
@param regexp マッチに用いる正規表現を指定します。
//emlist[例][ruby......]{
require 'strscan'
s = StringScanner.new('test string')
p s.match?(/\w+/) #=> 4
p s.match?(/\w+/) #=> 4
p s.match?(/\s+/) #=> nil
//}... -
Scanf
:: FormatString # last _ match _ tried (15218.0) -
@todo
...@todo... -
Scanf
:: FormatString # matched _ count (15217.0) -
@todo
...@todo...