What is the difference between ruby's StringScanner#post_match
and StringScanner#rest
?
scanner = StringScanner.new('Say hello to...')
scanner.scan(/\w+/) #=> 'Say'
scanner.scan(/\s+/) #=> ' '
scanner.rest #=> 'hello to...'
scanner.post_match #=> 'hello to...'
scanner.rest.class #=> String
scanner.post_match.class #=> String
I don't see a difference. It seems like both return a string containing everything after the match.