Регулярные выражения иногда могут быть просто монструозными. Выглядеть это может крайне запутанно. Сами регэкспы и без того история непростая, а когда это длинный паттерн на несколько десятков знаков, разобрать там что-либо становится не просто.
Но на помощь приходит Python и его стремление сделать нашу жизнь проще!
В функциях регулярок можно после паттерна указывать флаги, один из которых позволяет писать паттерны более свободно. А именно, добавлять пробелы и переносы, которые будут игнорированы. В результате мы можем разбить паттерн на строки и добавить комментов.
Чтобы это сработало нужно добавить флаг re.VERBOSE. Пробелы в паттерне теперь следует указывать явно спец символами.
Согласитесь, что даже с именованными группами а таком виде регэкспа выглядит вполне сносно 😉.
#tricks#regex
Ethiopia’s First R21 Malaria Vaccine Rollout, A Global First In A Refugee Camp (MSF)
https://borkena.com/2025/12/15/ethiopias-first-r21-malaria-vaccine-rollout-a-global-first-in-a-refugee-camp/#Ethiopia#Malaria#MSF
#Afar: Delivering lifesaving nutrition across one of #Ethiopia’s harshest landscapes
Once you leave the city of #Semera behind, the Ethiopian landscape quickly opens into vast stretches of dry earth that seem to run endlessly toward the horizon.
Sparse green bushes dot the dusty ground, framed by distant mountains and volcanoes that define the Afari landscape. As our vehicles drive toward the town of Magenta to deliver nutrition to children through Doctors Without Borders/Médecins Sans Frontières (#MSF) outreach activities, a river runs alongside the road. One of the main challenges faced by local communities is right in front of our eyes: water.
Afar, crossed by the Danakil Depression marking the northern end of the East African Rift Valley, is considered one of the hottest inhabited places on Earth.
Water availability and quality in the region are strongly influenced by its.....
https://www.facebook.com/AddisstandardEng/posts/pfbid02eyGnawFb7VhMHg63k8WpiMijY9FpwCawUmrdsKrtzRv4KyRYPzEBTN3ngQUxCZpEl
Sexual violence is being used as a weapon in #Sudan’s war, doctors group says
#Sexual_violence against women and girls is being used as a weapon of war in Sudan ‘s fierce conflict between the military and paramilitary Rapid Support Forces (#RSF), international aid group Doctors Without Borders said in a report Tuesday.
Sudan slid into chaos in April 2023 when a power struggle between the two forces exploded into open fighting in Khartoum and elsewhere. The International Criminal Court is investigating mass killings, gang rapes and other crimes during the conflict as potential war crimes and crimes against humanity.
Doctors Without Borders, known by its French acronym #MSF, detailed in its report the accounts of women who were gang raped in the South #Darfur and North Darfur regions.
MSF said that at least 3,396 survivors of sexual violence sought treatment at their facilities between January 2024......
https://apnews.com/article/sudan-war-darfur-sexual-violence-rape-rsf-bead0dded97628032066141e063e41e5