On Thu, Feb 10, 2005 at 06:25:06AM +0900, Florian Gross wrote: [snip] > str = "hello world" > str[/.(.)/, 1] # => "e" > str[/\s(.+)/, 1] = "bar" > str # => "hello bar" and $1 # => "world" Isn't it too bad a non-match raises an IndexError instead of returning nil? irb(main):006:0> if str[/(hello)/, 1] = ""; puts "match", $1; end match hello => nil irb(main):007:0> if str[/(hallo)/, 1] = ""; puts "match", $1; end IndexError: regexp not matched from (irb):7:in `[]=' from (irb):7 irb(main):008:0> -- Jos Backus _/ _/_/_/ Sunnyvale, CA _/ _/ _/ _/ _/_/_/ _/ _/ _/ _/ jos at catnook.com _/_/ _/_/_/ require 'std/disclaimer'