11件ヒット
[1-11件を表示]
(0.051秒)
ライブラリ
- strscan (11)
クラス
- StringScanner (11)
検索結果
-
StringScanner
# pre _ match -> String | nil (24384.0) -
前回マッチを行った文字列のうち、マッチしたところよりも前の 部分文字列を返します。前回のマッチが失敗していると常に nil を 返します。
...していると常に nil を
返します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.pre_match # => nil
s.scan(/\w+/) # => "test"
s.pre_match # => ""
s.scan(/\w+/) # => nil
s.pre_match # => nil
s.scan(/\s+/) # => " "
s.pre_match # => "test"
s.scan(/\w......+/) # => "string"
s.pre_match # => "test "
s.scan(/\w+/) # => nil
s.pre_match # => nil
//}...