runpaint / read-ruby

Free ebook about Ruby 1.9
http://ruby.runpaint.org/
148 stars 28 forks source link

Regexp: \Q is documented but not supported in ONIG_SYNTAX_RUBY #106

Closed ammar closed 14 years ago

ammar commented 14 years ago

According to RE.txt in Oniguruma, \Q and \E are only available for ONIG_SYNTAX_PERL and ONIG_SYNTAX_JAVA. \Q appears in Escapes table (src/regexps.xml#L384)

Simple test seems to confirm:

>> RUBY_DESCRIPTION
=> "ruby 1.9.2p0 (2010-08-18 revision 29036) [i386-darwin9.8.0]"
>> "a.c" =~ /a\Q.c/
=> nil
>> "aQ.c" =~ /a\Q.c/
=> 0
>> "aQbc" =~ /a\Q.c/
=> 0

If I'm mistaken, then closing \E is missing in documentation.

Thanks.

runpaint commented 14 years ago

Regexps: Ruby doesn't support \Q escape. Closed by 2a93bac7848118b3d66c03dd82523e88a9247dfa.