Just some stuff about me.
Here's my dotfiles repository.
What links here:
Combine f"{whatever}"
with r"""..."""
to make something like this:
code = r"""
[A-Z]*H # prefix
\d+ # digits
[a-z]* # suffix
"""
multicode = fr"""
(?: \( \s* )? # maybe open paren and maybe space
{code} # one code
(?: \s* \+ \s* {code} )* # maybe followed by other codes, plus-separated
(?: \s* [\):+] )? # maybe space and maybe close paren or colon or plus
"""
pattern = fr"""
( {multicode} ) # code (capture)
( .*? ) # message (capture): everything ...
(?= # ... up to (but excluding) ...
{multicode} # ... the next code
(?! [^\w\s] ) # (but not when followed by punctuation)
| $ # ... or the end
)
"""
Caveats:
"""(?x)..."""