Is it possible to remove a block comment without removing the line breaks with a regex?
Let's say I have this text:
text = """Keep this /* this has to go
this should go too but leave empty line */
This stays on line number 3"""
I came up with this regex:
text = re.sub(r'/\*.*?\*/', '', text, 0, re.DOTALL)
But this gives me:
Keep this
This stays on line number 3
What I want is:
Keep this
This stays on line number 3
Can it be done?