ruby - Using Regex to grab multiple values from a string and drop them into an array? -


Trying to catch two $ values ​​and X values ​​from this string in Ruby / Water:

16.67%: $ xxx.xx below, policy fees and x installations of $ xxx.xx are included in the

So far I have found:

  16.67%: \ s + \ $ (\ d +. \ D {2})   

which first fixes xxx.xx, what should I do to catch it last Load it into two variables and an array?

You can use the following, but regex if the surrounding text is always the same then it is unnecessary :

  \ $ (\ d +. \ D {2}). *? (\ D +) installments. *? \ $ (\ D + \ D {2})   



Comments