nice one David! On Tue, Apr 27, 2010 at 5:34 PM, David A. Black <dbl...@rubypal.com> wrote:
> Hi -- > > On Tue, 27 Apr 2010, Vladimir Rybas wrote: > > "Antigua and Barbuda (+1268)".scan(/\d+/).to_s >> => 1268 >> >> "Antigua and Barbuda (+1268)".scan(/\(\+\d+\)/).to_s >> => (+1268) >> > > There's a nice technique for quickly getting a substring from a > string using a subscript-style notation: > > "Antigua and Barbuda (+1268)"[/\(\+\d+\)/] # "(+1268)" > > > David > > -- > David A. Black, Senior Developer, Cyrus Innovation Inc. > > THE Ruby training with Black/Brown/McAnally > COMPLEAT Coming to Chicago area, June 18-19, 2010! > RUBYIST http://www.compleatrubyist.com > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.