I would like to parse codetags in source files. I wrote this regex that works fine with PCRE:
(?<tag>(?&TAG)):\s*
(?<message>.*?)
(
<
(?<author>(?:\w{3}\s*,\s*)*\w{3})?\s*
(?<date>(?&DATE))?
(?<flags>(?&FLAGS))?
>
)?
$
(?(DEFINE)
(?<TAG>\b(NOTE|LEGACY|HACK|TODO|FIXME|XXX|BUG))
(?<DATE>\d{4}-\d{2}-\d{2})
(?<FLAGS>[pts]:\w+\b)
)
Unfortunately it seems Python doesn't understand the DEFINE (https://regex101.com/r/qH1uG3/1#pcre)
What is the best workaround in Python?