[MacRuby] #1012: Inconsistent Regex behaviour

MacRuby ruby-noreply at macosforge.org
Tue Nov 30 18:42:00 PST 2010


#1012: Inconsistent Regex behaviour
-------------------------------------------+--------------------------------
 Reporter:  harry@…                        |        Owner:  lsansonetti@…        
     Type:  defect                         |       Status:  reopened             
 Priority:  minor                          |    Milestone:                       
Component:  MacRuby                        |   Resolution:                       
 Keywords:                                 |  
-------------------------------------------+--------------------------------

Comment(by lsansonetti@…):

 I found out the problem in "lib/net/imap.rb" line 3113, here is a
 reduction:

 {{{
 $ cat t2.rb
 str = "220 mx.google.com ESMTP v56sm7014509eeh.14\r\n"
 re = /\G(?:(?# 1:  SPACE   )( +)|(?# 2:  NIL     )(NIL)(?=[\x80-\xff(){
 \x00-\x1f\x7f%*"\\\[\]+])|(?# 3:  NUMBER  )(\d+)(?=[\x80-\xff(){
 \x00-\x1f\x7f%*"\\\[\]+])|(?# 4:  ATOM    )([^\x80-\xff(){
 \x00-\x1f\x7f%*"\\\[\]+]+)|(?# 5:  QUOTED
 )"((?:[^\x00\r\n"\\]|\\["\\])*)"|(?# 6:  LPAR    )(\()|(?# 7:  RPAR
 )(\))|(?# 8:  BSLASH  )(\\)|(?# 9:  STAR    )(\*)|(?# 10: LBRA
 )(\[)|(?# 11: RBRA    )(\])|(?# 12: LITERAL )\{(\d+)\}\r\n|(?# 13: PLUS
 )(\+)|(?# 14: PERCENT )(%)|(?# 15: CRLF    )(\r\n)|(?# 16: EOF
 )(\z))/i
 pos = 0
 str.index(re, pos)
 p $+
 $ ruby t2.rb
 "220"
 $ ./miniruby t2.rb
 nil
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1012#comment:13>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list