Регулярные выражения иногда могут быть просто монструозными. Выглядеть это может крайне запутанно. Сами регэкспы и без того история непростая, а когда это длинный паттерн на несколько десятков знаков, разобрать там что-либо становится не просто.
Но на помощь приходит Python и его стремление сделать нашу жизнь проще!
В функциях регулярок можно после паттерна указывать флаги, один из которых позволяет писать паттерны более свободно. А именно, добавлять пробелы и переносы, которые будут игнорированы. В результате мы можем разбить паттерн на строки и добавить комментов.
Чтобы это сработало нужно добавить флаг re.VERBOSE. Пробелы в паттерне теперь следует указывать явно спец символами.
Согласитесь, что даже с именованными группами а таком виде регэкспа выглядит вполне сносно 😉.
#tricks#regex
In parts of Togo, wedding ceremonies include the groom’s family performing dances and music. These performances show respect to the bride’s family and celebrate the upcoming marriage. The events often involve drumming, singing, and group dancing as part of the traditional festivities.
💃🥁💍🌍
[Read more]
@googlefactss
#marriage#culture#tradition#worldfacts#anthropology#africa#weddingrituals#travel
If you have ideas or feedback contact us:
@Googlefactss_Feedback_bot
In certain Thai weddings, couples participate in the Sai Sin ritual, a sacred tradition rooted in Buddhist beliefs. A cotton thread, called Sai Sin, is blessed by monks before the ceremony. The thread is tied around the bride and groom’s wrists or connected around their heads. This ritual symbolizes protection, good luck, and spiritual blessings for the couple. Guests and family may also touch or tie pieces of the thread to pass on their blessings. The Sai Sin connects the newlyweds to their family, community, and the monks who bless them, emphasizing unity and shared support. It is often performed alongside other traditional Thai wedding customs like pouring holy water over the hands of the bride and groom.
🧵👰🤵🇹🇭
[Read more]
@googlefactss
#marriage#culture#tradition#worldfacts#anthropology#thailand#weddingrituals#travel
In some Mexican weddings, couples participate in the Lazo ritual. A large cord or rosary is placed around the bride and groom in a figure-eight shape to symbolize unity and lifelong commitment.
🤍👰🤵🇲🇽
[Read more1]
[Read more2]
@googlefactss
#marriage#culture#tradition#worldfacts#anthropology#mexico#weddingrituals#travel