Bugs item #3329, was opened at 2006-01-26 00:55
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=3329&group_id=426

>Category: Triage (do not select)
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nikolai Lugovoi (meadow)
Assigned to: Nobody (None)
Summary: String#scan loops forefever if scanned string is modified inside block.

Initial Comment:
ruby 1.8.4 (2005-12-24)

Following code loops infinitely:

a = " 12345678 "; a.scan(/\d/) {|s| a[3,2]='test';  s} 

----------------------------------------------------------------------

Comment By: Paul Duncan (pabs)
Date: 2006-01-26 12:33

Message:
I've posted a comment this on ruby-core at the following URL:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/7220

Basically, I'm not convinced the "fix" to this problem is better than just leaving things as-is.  My suggestion, and patch, is a clarification in the documentation that discourages people from modifying the receiving string inside a String#scan block.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=3329&group_id=426