> Pick Axe page 70-75:
>
> ruby-1.9.2-head > s = '12.7 AB36'
>  => "12.7 AB36"
> ruby-1.9.2-head > pattern = /\A([0-9.]+)\s*([a-zA-Z]{1,2}[0-9]+)\Z/
>  => /\A([0-9.]+)\s*([a-zA-Z]{1,2}[0-9]+)\Z/
> ruby-1.9.2-head > s.match pattern
>  => #<MatchData "12.7 AB36" 1:"12.7" 2:"AB36">
> ruby-1.9.2-head > $1
>  => "12.7"
> ruby-1.9.2-head > $2
>  => "AB36"
>
> HTH,
>
> Peter

Peter!!!! You are *THE* man!!!  I actually just bought the 1.9.2 version 
of the book for just $10. Regular Expressions are now on page 97 
(Chapter 7). I'm an FoxPro programmer and just beginning my work in 
Ruby.

I threw your pattern and match command into a Controller action in my 
Rails app, and guess what.... It works!!

Here's my code, after just 1 minute of work, thanks to you. (Some 
refinements are now needed for stupid user input, but I'll get.

I'm so excited to see this come to life so easily. The Ruby community is 
awesome.

  def create
    @conversion = Conversion.new(params[:conversion])
    pattern = /\A([0-9.]+)\s*([a-zA-Z]{1,2}[0-9]+)\Z/
    user_input = @conversion.shaft_size
    @size = user_input.match pattern

    respond_to do |format|
      format.html { render :show }
    end
  end


Now I can access the @size[1] and @size[2] to get what I need done.

How many times can I say "Thanks"???

-- 
Posted via http://www.ruby-forum.com/.