Регулярные выражения иногда могут быть просто монструозными. Выглядеть это может крайне запутанно. Сами регэкспы и без того история непростая, а когда это длинный паттерн на несколько десятков знаков, разобрать там что-либо становится не просто.
Но на помощь приходит Python и его стремление сделать нашу жизнь проще!
В функциях регулярок можно после паттерна указывать флаги, один из которых позволяет писать паттерны более свободно. А именно, добавлять пробелы и переносы, которые будут игнорированы. В результате мы можем разбить паттерн на строки и добавить комментов.
Чтобы это сработало нужно добавить флаг re.VERBOSE. Пробелы в паттерне теперь следует указывать явно спец символами.
Согласитесь, что даже с именованными группами а таком виде регэкспа выглядит вполне сносно 😉.
#tricks#regex
Vaccines strengthen our immunity and protect us from many preventable diseases. 💪
They help keep individuals, families, and communities safe and healthy.
✅️Ensure you and your loved ones stay up to date and complete your vaccine doses — it’s one of the best ways to stay protected and live healthy!
Stay informed. Stay protected. Stay healthy. ✔️
# #NCDCNigeria#StayProtected#HealthyNigeria#HealthyLiving
#WellnessWednesday: Boost Your Immunity, Stay Protected! 🛡️🥦
Your immune system is your first line of defense against infections, including Mpox and other diseases. Keep it strong with these healthy habits:
🥗 Eat a balanced diet rich in fruits, vegetables, and proteins
🚶♂️ Stay active with regular exercise
💧 Hydrate: drink plenty of water daily
😴 Get enough sleep to support immune function
🧼 Practice good hygiene: wash hands frequently and keep surroundings clean
💉 Stay up to date on vaccinations where applicable
A strong immune system means a healthier you! Take charge of your wellness today.
#WellnessWednesday#HealthyLiving#BoostYourImmunity#StayProtected#NCDCNigeria
#WellnessWednesday: Boost Your Immunity, Stay Protected! 🛡️🥦
Your immune system is your first line of defense against infections, including Mpox and other diseases. Keep it strong with these healthy habits:
🥗 Eat a balanced diet rich in fruits, vegetables, and proteins
🚶♂️ Stay active with regular exercise
💧 Hydrate—drink plenty of water daily
😴 Get enough sleep to support immune function
🧼 Practice good hygiene—wash hands frequently and keep surroundings clean
💉 Stay up to date on vaccinations where applicable
A strong immune system means a healthier you! Take charge of your wellness today.
#WellnessWednesday#HealthyLiving#BoostYourImmunity#StayProtected#NCDCUpdates
#Yellow fever is a serious but vaccine preventable viral disease.
It spreads through the bite of infected mosquitoes
Protect yourself by:
▶️Getting vaccinated💉
▶️Maintaining a clean environment to stop mosquitoes from breeding.
▶️ Use insect repellent and sleep under treated nets to avoid mosquito bites.
⚠️ Report early to a nearby health facility if you feel unwell with symptoms like fever, headache, or yellowing of the eyes/skin.
#YellowFever#StayProtected#HealthyNigeria#NCDCNigeria