From: dblack@... Date: 2007-07-06T08:00:18+09:00 Subject: Re: Newbie regexp question Hi -- On Fri, 6 Jul 2007, Harold Hausman wrote: > On 7/5/07, Skt wrote: >> Newbs here, decided to take today to learn regular expression. >> > > You're brave to try and learn regular expressions in a day. I > recommend you accept now that it will be a life long journey. (: > >> What i want to do is take a sentence and just pull two things from it. >> Example: >> >> "My address is 68 Ohio" >> >> I want to pull address and 68 from the sentence but that pesky is is >> getting in my way(or im too newb) >> >> "My address is 68 ohio" =~ /\w{7}\d{2}/ is what i tried but continuous >> nils. Any help? >> >> > > What do you think of this: ? > irb(main):005:0> s = "My address is 68 ohio" > => "My address is 68 ohio" > irb(main):006:0> r = /(address)[^\d]+(\d+)/ You can also use \D for non-digit. David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)