From: Daniel Navarro Date: 2011-08-11T03:46:21+09:00 Subject: Re: Reg Ex Help Required --000e0cd2158c8d4c6104aa2b18b5 Content-Type: text/plain; charset=ISO-8859-1 alternatively you could make the two inputs variables and the output you are trying to recieve a variable as well that way you would never have to worry about regexing anything. You would simply reference the variable . . . You can of course create a class as well . . . puts "First Number" r = gets.chomp puts "Second Number" p = gets.chomp x = p * r puts x class Someclass def initialize (First Number, Second Number) @First Number = First Number @Second Number = Second Number end end Calc = Someclass.new(0,1) x = calc.first * calc.last Of course if you're working with floats or strings back and forth just add the to_f or to_s. I haven't worked on ruby in a while but maybe this will help you spawn some ideas. On Wed, Aug 10, 2011 at 1:30 PM, Chris White wrote: > > On Aug 10, 2011, at 11:20 AM, saurabh a. wrote: > > > Hi, > > > > Please help me with regular expression. > > > > str = "abc = 100.300" > > > > i want to write a regular xpression for getting the value after =, i.e. > > 100.300, i mean reg ex should return value after = > > Might I suggest an alternative to regex? > > irb(main):003:0> str.split(/ = /) > => ["abc", "100.300"] > irb(main):004:0> str.split(/ = /)[1] > => "100.300" > irb(main):005:0> > > Regards, > Chris White > http://www.twitter.com/cwgem > > --000e0cd2158c8d4c6104aa2b18b5--