ライブラリ
- ビルトイン (263)
-
irb
/ cmd / help (12) -
net
/ telnet (8) -
rdoc
/ context (12) -
rubygems
/ gem _ path _ searcher (12) - scanf (30)
- strscan (144)
クラス
-
Gem
:: GemPathSearcher (12) -
IRB
:: ExtendCommand :: Help (12) - MatchData (158)
-
Net
:: Telnet (8) -
RDoc
:: Context (12) - Regexp (12)
-
Scanf
:: FormatSpecifier (6) -
Scanf
:: FormatString (24) - String (81)
- StringScanner (144)
- Symbol (12)
キーワード
- =~ (12)
- [] (48)
- captures (12)
-
check
_ until (12) - cmd (4)
- deconstruct (2)
- execute (12)
- gsub (12)
- gsub! (12)
- inspect (12)
-
last
_ match _ tried (6) - match? (21)
- matched (12)
- matched? (12)
-
matched
_ count (6) -
matched
_ size (12) -
matched
_ string (6) - matchedsize (12)
-
matching
_ files (12) - names (12)
-
post
_ match (24) -
pre
_ match (24) - prune (6)
-
scan
_ full (12) -
scan
_ until (12) -
skip
_ until (12) - sub (12)
- sub! (12)
-
to
_ a (12) -
to
_ s (12) -
unmatched
_ alias _ lists (12) - unscan (12)
-
values
_ at (12) - waitfor (4)
検索結果
先頭5件
-
String
# match(regexp , pos = 0) -> MatchData | nil (30413.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 (30213.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... -
MatchData
# string -> String (27415.0) -
マッチ対象になった文字列の複製を返します。
...マッチ対象になった文字列の複製を返します。
返す文字列はフリーズ(Object#freeze)されています。
//emlist[例][ruby]{
m = /(.)(.)(\d+)(\d)/.match("THX1138.")
m.string # => "THX1138."
//}... -
Scanf
:: FormatString # match(str) (24102.0) -
@todo
@todo -
Symbol
# match(other) -> MatchData | nil (18344.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?... -
Scanf
:: FormatSpecifier # matched _ string (18302.0) -
@todo
@todo -
Symbol
# match(other) -> Integer | nil (18238.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... -
String
# match?(regexp , pos = 0) -> bool (18164.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?... -
StringScanner
# matched _ size -> Integer | nil (15207.0) -
前回マッチした部分文字列の長さを返します。 前回マッチに失敗していたら nil を返します。
...nil を返します。
マッチしたサイズは文字単位でなくバイト単位となります。
//emlist[][ruby]{
require 'strscan'
def run(encode)
utf8 = "\u{308B 3073 3044}" # るびい
s = StringScanner.new(utf8.encode(encode))
s.scan(/#{"\u{308B}".encode(encode)}/)
s.matched......_size
end
p run("UTF-8") #=> 3
p run("EUC-JP") #=> 2
p run("Shift_Jis") #=> 2
//}
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.matched_size # => nil
s.scan(/\w+/) # => "test"
s.matched_size # => 4
s.scan(/\w+/) # => nil
s.matched_size # => nil
//}... -
Scanf
:: FormatString # last _ match _ tried (15202.0) -
@todo
@todo -
StringScanner
# matchedsize -> Integer | nil (15201.0) -
StringScanner#matched_size と同じです。
...
StringScanner#matched_size と同じです。
このメソッドは は将来のバージョンで削除される予定です。
代わりに StringScanner#matched_size を使ってください。
@see StringScanner#matched_size... -
Gem
:: GemPathSearcher # matching _ files(spec , path) -> [String] (12402.0) -
与えられた spec に path が含まれている場合、その path のリストを返します。
...与えられた spec に path が含まれている場合、その path のリストを返します。
@param spec Gem::Specification のインスタンスを指定します。
@param path 探索対象のパスを指定します。...