mruby Regexp check with onig
Closed this issue · 3 comments
zzak commented
Some method in mruby, like String#slice should be able to use OnigRegexp. For example,
# in MRI
>> "123hello456".slice(/[a-z]+/) #=> "hello"
# in mruby
> "123hello456".slice(/[a-z]+/)
(mirb):1: Regexp class not implemented (NotImplementedError)
> "123hello456".slice(OnigRegexp.new("/[a-z]+/"))
(mirb):2: Regexp class not implemented (NotImplementedError)It seems they are using mrb_regexp_check.
Any ideas?
mattn commented
I'm not sure but Regexp is defined at https://github.com/mattn/mruby-onig-regexp/blob/master/mrblib/onig_regexp.rb#L55
mattn commented
Unfortunately, mruby still not ready to use Regexp.
See https://github.com/mruby/mruby/blob/master/src/string.c#L1761
zzak commented
@mattn Thanks for your patch!
I'd like to find a way to resolve this, re: mruby/mruby#2881, and avoid duplication.