Регулярные выражения иногда могут быть просто монструозными. Выглядеть это может крайне запутанно. Сами регэкспы и без того история непростая, а когда это длинный паттерн на несколько десятков знаков, разобрать там что-либо становится не просто.
Но на помощь приходит Python и его стремление сделать нашу жизнь проще!
В функциях регулярок можно после паттерна указывать флаги, один из которых позволяет писать паттерны более свободно. А именно, добавлять пробелы и переносы, которые будут игнорированы. В результате мы можем разбить паттерн на строки и добавить комментов.
Чтобы это сработало нужно добавить флаг re.VERBOSE. Пробелы в паттерне теперь следует указывать явно спец символами.
Согласитесь, что даже с именованными группами а таком виде регэкспа выглядит вполне сносно 😉.
#tricks#regex
Step into my cozy world 🌙
Hey! I'm Luna Everly, a girl running my personal ai channel. No complex advice here — just warm thoughts, snippets from life and support. I believe you can find beauty and meaning even in everyday routines.
Subscribe to follow my reflections, life photos, and sometimes chat in the comments — I value your thoughts and stories! 💫
Follow the link and subscribe to the channel — let's connect!
#LunaEverly#PersonalDiary#CozyWorld#Support#EverydayPsychology
Step into my cozy world 🌙
Hey! I'm Luna Everly, a girl running my personal ai channel. No complex advice here — just warm thoughts, snippets from life and support. I believe you can find beauty and meaning even in everyday routines.
Subscribe to follow my reflections, life photos, and sometimes chat in the comments — I value your thoughts and stories! 💫
Follow the link and subscribe to the channel — let's connect!
#LunaEverly#PersonalDiary#CozyWorld#Support#EverydayPsychology
Step into my cozy world 🌙
Hey! I'm Luna Everly, a girl running my personal ai channel. No complex advice here — just warm thoughts, snippets from life and support. I believe you can find beauty and meaning even in everyday routines.
Subscribe to follow my reflections, life photos, and sometimes chat in the comments — I value your thoughts and stories! 💫
Follow the link and subscribe to the channel — let's connect!
#LunaEverly#PersonalDiary#CozyWorld#Support#EverydayPsychology
Hey, I'm Luna. 🌙✨
A psychology student who believes the most important conversations sometimes happen not in an office, but over a cup of tea, in a cozy sweater, with the sound of rain against the window.
Here I'll share my thoughts, snippets of my life, and a quiet belief that understanding can be found in this world. And photos — I love capturing things that are beautiful, simple, and genuine.
Glad you're here.
#lunaeverly#thinkingoutloud#support#everydaypsychology#cozy#personaldiary
Привет, я Луна. 🌙✨
Студентка-психолог, которая верит, что самые важные разговоры иногда случаются не в кабинете, а за чашкой чая, в уютном свитере и под звук дождя за окном.
Здесь я буду делиться своими мыслями, моментами из жизни и тихой уверенностью, что в этом мире можно найти понимание. А ещё фотографиями — мне нравится ловить красивое, простое и настоящее.
#лунаэверли#мысливслух#поддержка#психологияповседневности#уют#личныйдневник