Регулярные выражения иногда могут быть просто монструозными. Выглядеть это может крайне запутанно. Сами регэкспы и без того история непростая, а когда это длинный паттерн на несколько десятков знаков, разобрать там что-либо становится не просто.
Но на помощь приходит Python и его стремление сделать нашу жизнь проще!
В функциях регулярок можно после паттерна указывать флаги, один из которых позволяет писать паттерны более свободно. А именно, добавлять пробелы и переносы, которые будут игнорированы. В результате мы можем разбить паттерн на строки и добавить комментов.
Чтобы это сработало нужно добавить флаг re.VERBOSE. Пробелы в паттерне теперь следует указывать явно спец символами.
Согласитесь, что даже с именованными группами а таком виде регэкспа выглядит вполне сносно 😉.
#tricks#regex
Let's work together to prevent the spread of #Lassafever.
Be a guardian of proper sanitation in your community and promote frequent #Handwashing with soap and running water.
Read our latest #LassaFever situation report:
https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria
Let's work together to prevent the spread of #Lassafever.
Be a guardian of proper sanitation in your community and promote frequent #Handwashing with soap and running water.
Read our latest #LassaFever situation report:
https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria
#Lassafever is preventable.
Be a guardian of proper hand hygiene in your community
Promote frequent #handwashing with soap and running water.
#LassaFeverInfo
#Handwashing with soap under clean, running water is very vital to the prevention of #cholera.
Important #handwashing moments⬇️
✅While caring for the ill
✅After using the toilet
✅Before food preparation
✅Before and after eating
✅After touching high-contact surfaces
#STOPcholera
#Handwashing is a basic and effective tool against infections.
If we do not become sick, we would not need to use #antimicrobials.
Encourage your loved ones to practice frequent #handwashing with soap under running water.
Do your part to prevent #AntimicrobialResistance
#HandHygiene with clean, running water is very vital to the prevention of #cholera.
Important #handwashing moments⬇️
✅While caring for the ill
✅After using the toilet
✅Before food preparation
✅Before and after eating
✅After touching high contact surfaces
#TakeResponsibility
#HandHygiene with soap under clean, running water is very vital to the prevention of #cholera.
Important #handwashing moments⬇️
✅While caring for the ill
✅After using the toilet
✅Before food preparation
✅Before and after eating
✅After touching high contact surfaces
#TakeResponsibility
#HandHygiene with clean, running water is very vital to the prevention of #cholera.
Important #handwashing moments⬇️
✅While caring for the ill
✅After using the toilet
✅Before food preparation
✅Before and after eating
✅After touching high contact surfaces
#TakeResponsibility
#HandWashing remains the most basic and effective means to prevent the spread of infections.
Frequent #handwashing with soap under running water at home, work, health facilities, gatherings, and public spaces is highly important to stay healthy.
Let us all make #cleanhands a regular habit. It protects us all.
#TakeResponsibility
#HandWashing is a basic &effective tool against infections.
If we don't become sick, we would not need to use #antibiotics.
Let us promote the practice of #handwashing in our homes & communities to prevent #AntimicrobialResistance together.
#WorldAntimicrobialAwarenessWeek2022