re = /(.+\n.+\n)(\d+\.\d{1,2})/m
str = 'RETAIL
UPRICE QTY TOTAL
ILLUSTRATION BOARD 15X20 (1/4 SIZE ) BY
1276
12.50 1.0 12.50
MONGOL PENCIL 1,2,3 PC
434
6.50 1.0 6.50
MS 300 (MGK) PERMANENT MARKER
1470
3.75 1.0 3.75
HBW White Glue 40 grans
1690
10.00 1.0 10.00
COLOR PEN 8 COLORS (VARIOUS BRAND)
1930
16.50 1.0 16.50
KS /CREATION CONSTRUCTION PAPER (105)
3503
23.00 1.0 23.00'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html