import re
regex = re.compile(r"Name:\s*(.*?)(<br>|\R)|Language:\s*(.*?)(<br>|\R)|Email:\s*(.*?)(<br>|\R)|Country:\s*(.*?)(<br>|\R)|cellNumber:\s*(.*?)(<br>|\R)|carBrand:\s*(.*?)(<br>|\R)|carModel:\s*(.*?)(<br>|\R)|carFuel:\s*(.*?)(<br>|\R)|carStatus:\s*(.*?)(<br>|\R)|carGear:\s*(.*?)(<br>|\R)|kmPassed:\s*(.*?)(<br>|\R)|productionYear:\s*(.*?)(<br>|\R)|carType:\s*(.*?)(<br>|\R)|Message:\s*(.*?)(\R)")
test_str = ("> Name: نادر\n"
"> Email: NADERFHRAN@GMAIL.COM\n"
"> Language: ar\n"
"> Country: المملكة\n"
"> cellNumber: 0966532450848\n"
"> carBrand: mercedes-benz\n"
"> carModel: C-Series|C300\n"
"> carFuel: gasoline\n"
"> carStatus: brand-new\n"
"> carGear: automatic\n"
"> kmPassed: 0\n"
"> productionYear: 2017\n"
"> carType: smallCar\n"
"> Message: اللون الاسود او الابيض ويفضل موديل 2016 او 2017 ")
subst = ""
result = regex.sub(subst, test_str)
if result:
print(result)
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 Python, please visit: https://docs.python.org/3/library/re.html