^^ my version:
s="$6,178.50 USD / 22,693.01 AED"
x=s.gsub(',','').split(/[ a-zA-Z\$\/]+/).reject{|x| x.empty?}

# x is ["6178.50", "22693.01"]

On Wed 10 Oct 2012 02:19:48 PM WIT, Robert Klemme wrote:
> On Wed, Oct 10, 2012 at 12:16 AM, ideal one <lists / ruby-forum.com> wrote:
>> Hi All,
>>       I have a String and i need to convert it into Currency format and
>> verify whether it matches to the expected.
>> Let me explain in detail
>>
>> String = "$6,178.50 USD / 22,693.01 AED"
>> I want to split it into 2 different variables like
>>
>> usa_price = $6,178.50
>> aed_price = 22,693.01
>>
>> expected_output= $6,178.50 * 3.67 = 22,693.01 (should match value in
>> AED)
>>
>> How do i do this in Ruby!!!
>
> If you always expect a division here is one way:
>
> irb(main):001:0> s = "$6,178.50 USD / 22,693.01 AED"
> => "$6,178.50 USD / 22,693.01 AED"
>
> irb(main):011:0>
> %r{\$(\d+(?:,\d+)*(?:\.\d+)?)\s*USD\s*/\s*(\d+(?:,\d+)*(?:\.\d+)?)\s*AED}
> =~ s and p $1, $2
> "6,178.50"
> "22,693.01"
> => ["6,178.50", "22,693.01"]
>
> Kind regards
>
> robert
>