Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "this line break must stay.
- but this one
- not."
- "this line break must stay.
- but this one not."
- import re
- p = re.compile('(?<!(?|!|.))n', re.MULTILINE)
- text = "hello,nMy name is Hal.nHow arenyou doing?n"
- re.sub(p, ' ', text)
- # outputs:
- 'hello, My name is Hal.nHow are you doing?n'
Add Comment
Please, Sign In to add comment