-
Notifications
You must be signed in to change notification settings - Fork 45
scan behaves on JRuby 9.4 differently from MRI #45
Copy link
Copy link
Closed
Description
Environment Information
jruby -v
jruby 9.4.0.0-SNAPSHOT (3.1.0) 2022-07-11 99fe5ca788 OpenJDK 64-Bit Server VM 11.0.13+8-Ubuntu-0ubuntu1.20.04 on 11.0.13+8-Ubuntu-0ubuntu1.20.04 +jit [x86_64-linux]
Expected Behavior
require 'strscan'
s = StringScanner.new('test string')
s.scan(/\w(\w)(\w*)/) # => "test"
s[0] # => "test"
s[1] # => "e"
s[2] # => "st"
s.scan(/\w+/) # => nil
s[0] # => nil
s[1] # => nil
s[2] # => nil
s.scan(/\s+/) # => " "
s[0] # => " "
s[1] # => nil
s[2] # => nil
s.scan(/\w(\w)(\w*)/) # => "string"
s[0] # => "string"
s[1] # => "t"
s[2] # => "ring"
Actual Behavior(jruby 9.4.0.0-SNAPSHOT and strscan-3.0.3-java.gem)
require 'strscan'
s = StringScanner.new('test string')
s.scan(/\w(\w)(\w*)/) # => "test"
s[0] # => "test"
s[1] # => "e"
s[2] # => "st"
s.scan(/\w+/) # => nil
s[0] # => nil
s[1] # => nil
s[2] # => nil
s.scan(/\s+/) # => " "
s[0] # => " "
s[1] # => "s"
s[2] # => "tr"
s.scan(/\w(\w)(\w*)/) # => "string"
s[0] # => "string"
s[1] # => "t"
s[2] # => "ring"
I found this behavior by jruby/jruby#7247 .
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels