Actions
Bug #7092
closedStringScanner start-of-line matches false positives, while lookbehind for a newline gives false negatives
Description
To reproduce:
>> require 'strscan'
>> ss = StringScanner.new("ab")
>> ss.scan(/./)
=> "a"
>> ss.scan(/^./) # expecting nil, since the head is in the middle of a line
=> "b"
As a workaround-that-didn't-work, I also tried looking behind for a newline, which seems never to match, even with the m
flag.
>> ss = StringScanner.new("a\nb")
>> ss.scan(/../m)
=> "a\n"
>> ss.scan(/(?<=\n)./m) # expecting "b", since the previous char is a newline
=> nil
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0