This stackoverflow Q&A got me thinking about various ways to construct a solution in
GNU sed if lookarounds are needed.
Only single line (with newline as the line separator) processing is presented here. Equivalent lookaround syntax with
perlis also shown for comparison. Cases where multiple lines and/or ASCII NUL characters are present in the pattern space is left as an exercise.