The rx macro in emacs (see http://www.emacswiki.org/emacs/rx and http://doc.endlessparentheses.com/Fun/rx ) allows you to define regular expressions in a modular and readable way (at least you donβt need to take care of problems with quotes). For example:
(rx "a" (optional "c") "b")
leads to
"ac?b"
Is there anything comparable in python?
IMO, LISP RegEx, . ? RegEx ; ; rx . Omnimark? . ...
rx
Omnimark
, :
def optional(regex): return regex + "?" def regex(*args): return "".join(args) REGEX = regex("a", optional("b"), "c") print(REGEX)
:
ab?c
Source: https://habr.com/ru/post/1624508/More articles:Exclude matched array elements - arraysarray functions biginteger - arraysModeling a pendulum in C - cPostgresql error intarray: undefined character: pfree - postgresqlHow can I sanitize laravel 5.X Request input? - phpWhat are the differences between: main () {}, int main () {} and int main (void) {} ββ- cMatlab bsxfun (@times, ..., ...) is equivalent in R - matrixΠΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ ΡΡΠ°ΡΡΠΊΠ° Bokeh Π² ΡΠ°ΠΉΡ Django ΠΏΡΠΈΠ²ΠΎΠ΄ΠΈΡ ΠΊ ΠΏΡΡΡΠΎΠΉ ΡΡΡΠ°Π½ΠΈΡΠ΅ Π±Π΅Π· ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΡ ΠΎΠ± ΠΎΡΠΈΠ±ΠΊΠ΅ - pythonThe Bokeh section does not appear on the same django page after csv loading - pythonΠΠ°ΠΊ ΡΠ°Π·ΡΠ΅ΡΠΈΡΡ ΠΏΡΠ΅Π΄ΡΠΏΡΠ΅ΠΆΠ΄Π΅Π½ΠΈΠ΅ Π»ΠΈΠ½ΠΊΠ΅ΡΠ° "ΠΈΠ³Π½ΠΎΡΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ Π½Π°ΠΌΠ΅ΠΊΠ° Π½Π° ΠΎΠΏΡΠΈΠΌΠΈΠ·Π°ΡΠΈΡ ΠΊΠΎΠΌΠΏΠΎΠ½ΠΎΠ²ΡΠΈΠΊΠ°" Π² XCode? - iosAll Articles