Регулярные выражения иногда могут быть просто монструозными. Выглядеть это может крайне запутанно. Сами регэкспы и без того история непростая, а когда это длинный паттерн на несколько десятков знаков, разобрать там что-либо становится не просто.
Но на помощь приходит Python и его стремление сделать нашу жизнь проще!
В функциях регулярок можно после паттерна указывать флаги, один из которых позволяет писать паттерны более свободно. А именно, добавлять пробелы и переносы, которые будут игнорированы. В результате мы можем разбить паттерн на строки и добавить комментов.
Чтобы это сработало нужно добавить флаг re.VERBOSE. Пробелы в паттерне теперь следует указывать явно спец символами.
Согласитесь, что даже с именованными группами а таком виде регэкспа выглядит вполне сносно 😉.
#tricks#regex
Viral Haemorrhagic Fevers #VHFs are a group of illnesses caused by viruses that damage blood vessels and can cause severe bleeding.
Our national guideline on #InfectionPreventionandControl for #VHFs is designed as a major reference for anyone involved in the care and management of #VHFs cases.
🔗Download and read via
https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf
Viral Haemorrhagic Fevers #VHFs are a group of illnesses caused by viruses that damage blood vessels and can cause severe bleeding.
Our national guideline on #InfectionPreventionandControl for #VHFs is designed as a major reference for anyone involved in the care and management of #VHFs cases.
🔗Download and read via
https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf
Viral Haemorrhagic Fevers such as #LassaFever spread mainly from person to person through direct & indirect contact.
When properly done, #HandHygiene is very important to reduce the risk of healthcare workers' infection.
Our #IPC guidelines for #VHFs⬇️
https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf
Viral hemorrhagic fevers #VHFs such as #LassaFever affect multiple organ systems in the body and may be accompanied by bleeding.
Download and share our National Guideline on #IPC for #VHF for measures required in the management of VHFs
🔗
https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf
Viral hemorrhagic fevers #VHFs are a group of infectious diseases that affect multiple organ systems in the body and may be accompanied by bleeding.
What are the #InfectionPreventionandControl practices that need to be in place in the management of VHFs?
🔗Download our National Guideline on #IPC for #VHF
https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf
Common Viral Haemorrhagic Fevers #VHFs include #LassaFever, #EbolaVirusDisease, #YellowFever, #DengueFever, #MarburgFever and #CrimeanCongoHaemorrhagicFever.
What are the #InfectionPreventionandControl practices that need to be in place in the management of VHFs?
🔗Download our National Guideline on #IPC for #VHF
https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf