I need to separate the brand from the model of a named car using a array of brands to match. I tried something like that:
import re
carName = "Fiat Strada Working 1.4 CS"
brands = ["Acura","Alfa Romeo","Aston Martin","Audi","Bentley","BMW","Bugatti","Buick","Cadillac","Chevrolet",
"Chrysler","Citroen","Dodge","Ferrari","Fiat","Ford","Geely","General Motors","GMC","Honda","Hyundai",
"Mercedes-Benz","Renault"]
carBrand = re.split("'|'.join(brands)|[^a-zA-Z ]+", carName)
print(carBrand)
But got this: ['Fiat Strada Working ', None, ' CS']
I need this: ['Fiat' , 'Strada Working 1.4 CS']
I'm having trouble finding the right regex to separate right after the join of brands.
Fiatwill be gone