re = /^[A-Z\d](?:(?!\d+\.\d)[A-Z\d.\h])*[A-Z]{3,}/m
str = 'ID.4 ESTATE 109kW City Pure 52kWh 5dr Auto
XC40 DIESEL ESTATE 2.0 D4 [190] Inscription Pro 5dr AWD Gea+
RAPID DIESEL HATCHBACK 1.6 TDI CR Elegance 5dr
MODEL 3 120kW LONG RANGE AWD
V40 DIESEL HATCHBACK D2 [120] Momentum 5dr Geartronic
V60 DIESEL SPORTSWAGON 2.0 D4 [190] R DESIGN Plus 5dr Auto
X3 ESTATE xDrive M40i 5dr Auto
C CLASS DIESEL SALOON C250 BlueTEC SE 4dr Auto
A CLASS DIESEL HATCHBACK A180d Sport Executive 5dr Auto
2 SERIES COUPE 218i Sport 2dr [Nav] Step Auto
HILUX SPECIAL EDITIONS Invincible X Ltd Ed D/Cab P/Up 2.4 D+
C3 PICASSO 1.6 BlueHDi Platinum 5dr
C3 HATCHBACK 1.2 PureTech 82 Flair 5dr
XC40 DIESEL ESTATE XC40
1'
# 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