Wondering whether it's a correct behaviour of recently introduced matching with a String pattern. Use Ruby 3.4.1 and strscan v3.1.2
String pattern:
require'strscan'scanner=StringScanner.new("こんにちは")scanner.scan_until("ち")# => "こんにち"scanner.pre_match# => ""scanner.matched# => "こんにち"scanner.post_match# => "は"Regexp pattern:
require'strscan'scanner=StringScanner.new("こんにちは")scanner.scan_until(/ち/)# => "こんにち"scanner.pre_match# => "こんに"scanner.matched# => "ち"scanner.post_match# => "は"When pattern is String then #pre_match and #matched work differently - #matched returns a substring from the current position to the end of a found substring and #pre_match returns "".
Wondering whether it's a correct behaviour of recently introduced matching with a String pattern. Use Ruby 3.4.1 and
strscanv3.1.2String pattern:
Regexp pattern:
When pattern is String then
#pre_matchand#matchedwork differently -#matchedreturns a substring from the current position to the end of a found substring and#pre_matchreturns"".