Slide 20
Slide 20 text
May 15th - 17th, 2024
NAHA CULTURAL ARTS THEATER NAHArt, Okinawa, Japan
Fix: StringScanner#captures
https://github.com/ruby/strscan/pull/72 (merged)
s = StringScanner.new('foobarbaz') #=> #
s.scan /(foo)(bar)(BAZ)?/ #=> "foobar"
s.captures #=> ["foo", "bar", ""]
s.captures.compact #=> ["foo", "bar", ""]
s = StringScanner.new('foobarbaz') #=> #
s.scan /(foo)(bar)(BAZ)?/ #=> "foobar"
s.captures #=> ["foo", "bar", nil]
s.captures.compact #=> ["foo", "bar"]
Before (not yet documented)
After (MatchData#captures like)