[MacRuby] #939: $1, $2 ... should store the value of local scope.

MacRuby ruby-noreply at macosforge.org
Wed Oct 6 20:03:33 PDT 2010


#939: $1, $2 ... should store the value of local scope.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 Test Script:
 {{{
 #!ruby
 str = "info at example.com?subject=current-issue"

 def test(str)
   str =~ /(.+)@(.+)/
 end

 if(str =~ /(.+)\?(.+)/)
   test($1)

   p $1
   p $2
 end
 }}}

 Result:
 {{{
 $ ruby -v test_regexp.rb
 ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
 "info at example.com"
 "subject=current-issue"

 $ ruby19 -v test_regexp.rb
 ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
 "info at example.com"
 "subject=current-issue"

 $ macruby -v test_regexp.rb
 MacRuby 0.8 (ruby 1.9.2) [universal-darwin10.0, x86_64]
 "info"
 "example.com"
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/939>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list