Регулярные выражения иногда могут быть просто монструозными. Выглядеть это может крайне запутанно. Сами регэкспы и без того история непростая, а когда это длинный паттерн на несколько десятков знаков, разобрать там что-либо становится не просто.
Но на помощь приходит Python и его стремление сделать нашу жизнь проще!
В функциях регулярок можно после паттерна указывать флаги, один из которых позволяет писать паттерны более свободно. А именно, добавлять пробелы и переносы, которые будут игнорированы. В результате мы можем разбить паттерн на строки и добавить комментов.
Чтобы это сработало нужно добавить флаг re.VERBOSE. Пробелы в паттерне теперь следует указывать явно спец символами.
Согласитесь, что даже с именованными группами а таком виде регэкспа выглядит вполне сносно 😉.
#tricks#regex
Fourth edition of the Africa Political Outlook: Africa marks the end of the aid era and asserts its strategic sovereignty. Read more.
https://borkena.com/2026/04/03/africa-political-outlook-africa-marks-the-end-of-the-aid-era-and-asserts-its-strategic-sovereignty/#Africa#Africapolitics@APO2026_
#Premiering_now: The Standard Signal | Ep.15: Ethiopia Under Pressure: Fuel Crisis, Global & Regional Instability, a Fragile Election | Jawar Mohammed
Click here to watch: https://www.youtube.com/watch?v=HexAbPk8Dkw
Ethiopia is facing mounting pressures. In Episode 15 of The Standard Signal, host Tsedale Lamma brings Jawar Mohammed to discuss the deepening fuel shortage and corruption concerns in Ethiopia, the looming fertilizer crisis and its implications for food security, and the impact of Middle East war on Ethiopia’s economy and stability.
#AddisStandard#TheStandardSignal#Ethiopia#JawarMohammed#EthiopiaPolitics#Corruption#FuelCrisis#HornOfAfrica#Tigray#Amhara#Oromia#EthiopiaElection#AfricaPolitics#EthiopiaNews#AfricanPolitics#Geopolitics
#Coming_UP: The Standard Signal | Ep.15: Ethiopia Under Pressure: Fuel Crisis, Global & Regional Instability, a Fragile Election | Jawar Mohammed
#TsedaleLemma speaks with #JawarMohammed about the growing challenges facing Ethiopia, from global and regional tensions to domestic instability, corruption and Ethiopia’s fragile election.
Premiers at: 7:30 PM EAT tonight.
Subscribe to watch: https://www.youtube.com/@AddisStandard
#AddisStandard#TheStandardSignal#Ethiopia#JawarMohammed#EthiopiaPolitics#Corruption#FuelCrisis#HornOfAfrica#Tigray#Amhara#Oromia#EthiopiaElection#AfricaPolitics#EthiopiaNews#AfricanPolitics#Geopolitics