正则 不匹配某个单词
import re
skip_word = 'hede'
stranger_char = '虩'
content = '''hoho
hihi
haha
hede'''
print(
'\n'.join(re.findall(
'([^{}]*?)\n'.format(stranger_char),
content.replace(skip_word, stranger_char)
)).replace(stranger_char, skip_word)
)
# hoho
# hihi
# haha