buty4649 ยท GitHub

The /n flag (ASCII-8BIT/binary encoding) in regular expressions is not working.

Reproduction Steps

onig-regexp.rb:

MRuby::Build.new do |conf|
conf.toolchain
conf.gembox 'default'
conf.gem mgem:'mruby-onig-regexp'
conf.enable_test
end

Bad (current HEAD):

git checkout HEAD
CONFIG=onig-regexp.rb rake clean all
./bin/mruby -e 'p(/\x82/n =~ "ใ‚")'
#=> nil

Good (before the issue)

git checkout 90c9525fd7fa0099933fca747145422bc5d77b48
CONFIG=onig-regexp.rb rake clean all
./bin/mruby -e 'p(/\x82/n =~ "ใ‚")'
#=> 2

Identified Problem Commit (via git bisect)

  • Good: 90c9525 (mruby-compiler: refactor lexer to always return cons lists...)
  • Bad: 6ad00d2 (mruby-compiler: refactor string representation to cons list format...)

Read the original on github.com โ†—