- Notifications
You must be signed in to change notification settings - Fork 41
Closed
Description
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 "".
Metadata
Metadata
Assignees
Labels
No labels