I have a string that I want to split by new line characters, but I want to leave the \n character in if it is at the start of the string. I know that \A matches the start of a string, but I don't know how to negate it. I'm guessing I would use something like:
re.split(r"(expression here) & (?<! )\n", text)
(I'm also leaving \n characters preceded by spaces in)
Can anyone point me in the right direction?
An example:
"
:10 e:1110 h:1111 l:110 o:000 x:001 y:010 z:011
11111110110110000100011001010011"
or
"\n:10 e:1110 h:1111 l:110 o:000 x:001 y:010 z:011\n11111110110110000100011001010011"
should come out as
["\n:10 e:1110 h:1111 l:110 o:000 x:001 y:010 z:011","11111110110110000100011001010011"]