Регулярные выражения иногда могут быть просто монструозными. Выглядеть это может крайне запутанно. Сами регэкспы и без того история непростая, а когда это длинный паттерн на несколько десятков знаков, разобрать там что-либо становится не просто.
Но на помощь приходит Python и его стремление сделать нашу жизнь проще!
В функциях регулярок можно после паттерна указывать флаги, один из которых позволяет писать паттерны более свободно. А именно, добавлять пробелы и переносы, которые будут игнорированы. В результате мы можем разбить паттерн на строки и добавить комментов.
Чтобы это сработало нужно добавить флаг re.VERBOSE. Пробелы в паттерне теперь следует указывать явно спец символами.
Согласитесь, что даже с именованными группами а таком виде регэкспа выглядит вполне сносно 😉.
#tricks#regex
📰 NEWS | Maduro Confirms Sale of Venezuelan Fertilizer Firm Monómeros to Colombia, Ending Privatization Rumors
Venezuelan and Colombian authorities are engaged in talks for the sale of agrochemical producer Monómeros. A confidential agreement reportedly set a base price.
The firm, which had a tumultuous time under Venezuelan opposition management, is set to be purchased by the Colombian state as the Petro government aims to maintain stability in the agricultural inputs market.
Read our report: https://venezuelanalysis.com/news/maduro-confirms-sale-of-venezuelan-fertilizer-firm-monomeros-to-colombia-ending-privatization-rumors/
#Monomeros#Fertilizer#Venezuela#GustavoPetro
In-depth Analysis: The #Fertilizer Paradox: Global shocks test #Ethiopia’s fragile, corruption-tainted supply chain
As Ethiopia approaches a critical agricultural season, mounting global disruptions, domestic corruption, and logistical bottlenecks induced by #fuel_shortages are converging to expose deep vulnerabilities in the country’s #fertilizer_supply chain.
While officials maintain that sufficient fertilizer has been secured for the current production cycle, contradictory statements from senior policymakers, corruption revelations, fuel shortage and reports of scarcity from farming communities suggest a widening gap between national preparedness and realities on the ground.
The emerging picture is one of a system already under strain, shaped by global geopolitical shocks abroad and persistent structural weaknesses at home.
Read the full In-depth Analysis:https://addisstandard.com/?p=56490