# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"^(Тема: )(.*)\n(Дата )(\d*.\d*.\d*)(.*)\n(Время )(.*)\n(Имя клиента )(.*)\n(Фамилия клиента )(.*)\n(Дата рождения )(.*)\n(Номер загран паспорта )(.*)\n(Дата окончания загран паспорта )(.*)\n(Гражданство )(.*)\n(Телефон )(.*)\n(E-mail )(.*)\n(Количество заявителей )(.*)\n(Инфо )(.*)\n(Ссылка)\n(.*)\n(.*)"
test_str = ("Тема: Запись на прием\n"
"Дата 28.03.2020 17:30 - 28.03.2020 18:00\n"
"Время 17:30 - 18:00\n"
"Имя клиента Vovka\n"
"Фамилия клиента Simi\n"
"Дата рождения 283983\n"
"Номер загран паспорта 9839283\n"
"Дата окончания загран паспорта 28492849284\n"
"Гражданство Hjccbz\n"
"Телефон 9248924898\n"
"E-mail mail@mail.ru\n"
"Количество заявителей 1\n"
"Инфо 237582hg8yfrvgdr\n"
"Ссылка\n"
"https://france-visa-official.ru/wp-admin/admin.php?page=wpbc&view_mode=vm_listing&tab=actions&wh_booking_id=15\n")
subst = "\\2,\\4,\\7,\\9,\\11,\\13,\\15,\\17,\\19,\\21,\\23,\\25,\\27,\\29"
# You can manually specify the number of replacements by changing the 4th argument
result = re.sub(regex, subst, test_str, 0, re.MULTILINE)
if result:
print (result)
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
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