From: "Iñaki Baz Castillo" Date: 2012-06-08T19:20:52+09:00 Subject: Re: Best way to partition a string 2012/6/8 Jan E. : > "Iñaki Baz Castillo" wrote in post #1063634: >> 2012/6/7 cyber c. : >> Regexp.new(/^([a-zA-Z]+)(.+)$/).match(str).captures > > Why are you using Regexp.new, when /^([a-zA-Z]+)(.+)$/ already *is* a > Regexp? This seems nonsensical to me, like String.new("abc"). Yes, I'm used to store my regexps in some module/class constants and usually use Regexp.new for some reason I don't remember right now, maybe because it allows passing a string which is useful in certain cases: Regexp.new("^([a-zA-Z]+)(.+)$") But right, in my previous code I was passing a Regexp instance to Regexp.new, which is not cool, sure :) -- Iñaki Baz Castillo