Регулярные выражения иногда могут быть просто монструозными. Выглядеть это может крайне запутанно. Сами регэкспы и без того история непростая, а когда это длинный паттерн на несколько десятков знаков, разобрать там что-либо становится не просто.
Но на помощь приходит Python и его стремление сделать нашу жизнь проще!
В функциях регулярок можно после паттерна указывать флаги, один из которых позволяет писать паттерны более свободно. А именно, добавлять пробелы и переносы, которые будут игнорированы. В результате мы можем разбить паттерн на строки и добавить комментов.
Чтобы это сработало нужно добавить флаг re.VERBOSE. Пробелы в паттерне теперь следует указывать явно спец символами.
Согласитесь, что даже с именованными группами а таком виде регэкспа выглядит вполне сносно 😉.
#tricks#regex
😄Accept
➖➖➖➖➖➖
Accept is a regular verb. Here are five common ways to use it:
🔘to agree to take something or receive something willingly, for example a gift, an award, an apology, responsibility for something or even a form of payment.
🔜Many shops don’t accept cash anymore.
🔜The actor accepted a life achievement award at a special ceremony.
🔘 to say yes to an invitation or an offer.
🔜She accepted the job straight away!
🔜I accepted Leon's dinner invitation from us both. I hope that's OK!
🔘to believe or recognise that something is true.
🔜The relationship has been over for weeks, but he still refuses to accept it.
🔜The police officer didn't accept the suspect's answer.
🔘to consider satisfactory or to give approval.
🔜Tommy was immediately accepted by the other children at his new school.
🔜Her boyfriend's family welcomed and accepted her straight away.
🔘to endure something without complaint.
🔜He accepted that he had lost the match.
🔜Even though it makes me sad, I accept that my one minute with you is up.
#Accept👨🏫@America
➖➖➖➖➖➖➖➖➖➖➖➖
🆕 Crypto News @Money
😁 Crypto Game @Egame
🇺🇸 US News @America
🇯🇵 Japan News @Japan
🇦🇪 UAE News @Dubai
▶️ Popular Movies @Videos
😜 Best Funny Video @Funnys
😄Accept
➖➖➖➖➖➖
Accept is a regular verb. Here are five common ways to use it:
🔘to agree to take something or receive something willingly, for example a gift, an award, an apology, responsibility for something or even a form of payment.
🔜Many shops don’t accept cash anymore.
🔜The actor accepted a life achievement award at a special ceremony.
🔘 to say yes to an invitation or an offer.
🔜She accepted the job straight away!
🔜I accepted Leon's dinner invitation from us both. I hope that's OK!
🔘to believe or recognise that something is true.
🔜The relationship has been over for weeks, but he still refuses to accept it.
🔜The police officer didn't accept the suspect's answer.
🔘to consider satisfactory or to give approval.
🔜Tommy was immediately accepted by the other children at his new school.
🔜Her boyfriend's family welcomed and accepted her straight away.
🔘to endure something without complaint.
🔜He accepted that he had lost the match.
🔜Even though it makes me sad, I accept that my one minute with you is up.
#Accept👨🏫@America
➖➖➖➖➖➖➖➖➖➖➖➖
🆕 Crypto News @Money
😁 Crypto Game @Egame
🇺🇸 US News @America
🇯🇵 Japan News @Japan
🇦🇪 UAE News @Dubai
▶️ Popular Movies @Videos
😜 Best Funny Video @Funnys