<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>InfoSauce: Ruby Conveniences</title>
  <id>tag:blog.infosauce.com,2005:Typo</id>
  <generator uri="http://www.typosphere.org" version="4.0">Typo</generator>
  <link href="http://blog.infosauce.com/xml/atom/article/14/feed.xml" rel="self" type="application/atom+xml"/>
  <link href="http://blog.infosauce.com/articles/2006/02/01/ruby-conveniences" rel="alternate" type="text/html"/>
  <updated>2006-10-26T21:41:16-07:00</updated>
  <entry>
    <author>
      <name>Tieg Zaharia</name>
    </author>
    <id>urn:uuid:16244861-2b0a-48d0-97a9-2aae95529195</id>
    <published>2006-02-01T23:49:00-08:00</published>
    <updated>2006-10-26T21:41:16-07:00</updated>
    <title type="html">Ruby Conveniences</title>
    <link href="http://blog.infosauce.com/articles/2006/02/01/ruby-conveniences" rel="alternate" type="text/html"/>
    <category term="ruby" scheme="http://blog.infosauce.com/articles/category/ruby" label="Ruby"/>
    <summary type="html">&lt;p&gt;Unbeknownst to me, there�s a quick way of doing a match &amp;amp; replace on a string in Ruby using just the brackets: (page 588 in the Ruby Book)&lt;/p&gt;

&lt;code style="font-size: 12px;"&gt;a = "bla bla bla"&lt;/code&gt;&lt;br&gt;
&lt;code style="font-size: 12px;"&gt;a[/a/i]="A"&lt;/code&gt;&lt;br&gt;
&lt;code style="font-size: 12px;"&gt;a =&amp;amp;gt; "blA bla bla"&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
Unfortunately it only does one replace instead of a global replace, but I don�t know enough about RegExp�s now to know if there�s a way to do a global replace with this?</summary>
    <content type="html">&lt;p&gt;Unbeknownst to me, there�s a quick way of doing a match &amp;amp; replace on a string in Ruby using just the brackets: (page 588 in the Ruby Book)&lt;/p&gt;

&lt;code style="font-size: 12px;"&gt;a = "bla bla bla"&lt;/code&gt;&lt;br&gt;
&lt;code style="font-size: 12px;"&gt;a[/a/i]="A"&lt;/code&gt;&lt;br&gt;
&lt;code style="font-size: 12px;"&gt;a =&amp;amp;gt; "blA bla bla"&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
Unfortunately it only does one replace instead of a global replace, but I don�t know enough about RegExp�s now to know if there�s a way to do a global replace with this?
</content>
  </entry>
  <entry>
    <author>
      <name>PJ Hyett</name>
    </author>
    <id>urn:uuid:15dd736c-51d1-459e-b0f5-70d12e1cd8c2</id>
    <published>2006-02-03T23:59:00-08:00</published>
    <updated>2006-10-22T21:34:46-07:00</updated>
    <title type="html">Comment on Ruby Conveniences by PJ Hyett</title>
    <link href="http://blog.infosauce.com/articles/2006/02/01/ruby-conveniences#comment-21" rel="alternate" type="text/html"/>
    <content type="html">&lt;p&gt;a.gsub(/a/,’A’)&lt;/p&gt;</content>
  </entry>
  <entry>
    <author>
      <name>Tim Connor</name>
    </author>
    <id>urn:uuid:af28924d-bb4d-4c7c-881b-0b5af1d8b5dc</id>
    <published>2006-02-02T00:07:00-08:00</published>
    <updated>2006-10-22T21:34:45-07:00</updated>
    <title type="html">Comment on Ruby Conveniences by Tim Connor</title>
    <link href="http://blog.infosauce.com/articles/2006/02/01/ruby-conveniences#comment-20" rel="alternate" type="text/html"/>
    <content type="html">&lt;p&gt;I guess I’m wrong – ruby doesn’t seem to support the g option. That’s lame.&lt;/p&gt;</content>
  </entry>
  <entry>
    <author>
      <name>Tim Connor</name>
    </author>
    <id>urn:uuid:2207fb49-afe9-4056-bbb2-b1c4edba2476</id>
    <published>2006-02-01T23:59:00-08:00</published>
    <updated>2006-10-22T21:34:46-07:00</updated>
    <title type="html">Comment on Ruby Conveniences by Tim Connor</title>
    <link href="http://blog.infosauce.com/articles/2006/02/01/ruby-conveniences#comment-19" rel="alternate" type="text/html"/>
    <content type="html">&lt;p&gt;It should be /a/ig, I believe, for global (i is ignore case, g is global)&lt;/p&gt;</content>
  </entry>
</feed>
