re = /(?<!\d|-|\/|to|\$)(?<!\$(\d)\.)([1-9][0-9]{0,2}(\.\d{0,2})?\s?)(lbs|lb|LBS|LB|KG|kg|G|g|L|l+)(?!\d|\w)/m
str = '10lb Potato bag
Apples Gld Delicious 3lb
Grandfer Rocha Pear2.5lbs
CHIN.MAND.5LB
Batata Veg (10LB)
SIG 170LB99 Legging SzB 1ea
ARJO CDA1450035 SupBlk 400LB1ea
AHC EB205L
DRI 10220-1 Bariatric500lb 1 ea
TILDA SONA MASOORI 20 LBS
OVAL ROASTER 9 - 12 LBS
ORGANIC TRIPACK FRUIT 1.2 KG
KGF5KT2404 PEPLUM T, PURPLE
AIR 1773LB-XL 15-20 KnXL 1ea
PLUM BAG 1KG US
NEXT XTRA 100G
SUDOCREM 60G
EGGPLANT GRILLED IN OIL (3KG)
CORONATION GRAPE 2L CA
MEAT DEAL $11.00 KG
LIVE LOBSTER- 2.00-3.00 LB-MSC
PC MAGIC GROW 20-20-20 3.55KG
KGF7W3409 KGVELCROWB,GREY
TZATZIKI 500G
2+1 LEAD MIX'
# 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