I know some basic concepts of regex. But when I need to but them together I'm failing. Here it IMHO comes to a negative lookahead. But I'm even not sure about if this is the right approach.
The input string is #+foo: bar: lore
.
The regex (Python3) is ^#\+(.*): *(.*)$
and extract me this two groups.
#+foo: bar: lore
^^^^^^^^ ^^^^
The output I wish is
#+foo: bar: lore
^^^ ^^^^^^^^^
Spoken in human language I would describe the first capturing group with "Everything after #+
until the first :
. The problem is that the last is used instead of the first :
.
So I thought a negative lookahead would be the solution. I tried several things but none of them worked. Here is one approach.
^#\+(.*(?!:)): *(.*)$
^^^^^