On Sat, Oct 6, 2012 at 12:25 PM,  <[email protected]> wrote:
> Am 06.10.2012 12:12, schrieb Robert Klemme:
>
>> On Sat, Oct 6, 2012 at 1:21 AM,  <[email protected]> wrote:
>>
>>> 1.9.3-p194 :001 > text = '"--- this is a string ---" = "--- this is a
>>> string
>>> ---";'
>>>   => "\"--- this is a string ---\" = \"--- this is a string ---\";"
>>> 1.9.3-p194 :002 > text.scan(/"(.*?)" = "(.*?)"/).flatten
>>>   => ["--- this is a string ---", "--- this is a string ---"]
>>
>> I'd rather use an approach which explicitly includes the "=" sign
>
> ???
>
> It does.

Right you are.  I let myself irritate by your usage of String#scan.
Sorry for that.

I do not think this is a case for #scan though since according to the
OP's description the String only contains one "assignment".  So it's
either "match" or "don't match".

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

-- You received this message because you are subscribed to the Google Groups 
ruby-talk-google group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email 
to [email protected]. For more options, visit this 
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en

Reply via email to