正则表达式删除包含一个任意单词的整个句子 [duplicate]

Regex to remove entire sentence containing one arbitrary word [duplicate]

提问人:TylerD 提问时间:11/15/2023 更新时间:11/15/2023 访问量:29

问:

我有以下句子结构

s = "this is a test, i want to end up with this sentence, this is two test, this is test"

我想用空格替换所有出现的 ,其中星号表示任意长度的随机单词。this is * test

因此,在上面的示例中,我希望以(逗号无关紧要,它们可以保留)作为 结束,并被删除。,i want to end up with this sentence, , this is a testthis is two testthis is test

有没有一个正则表达式可以捕捉到这一点?

Python 正则表达式

评论


答: 暂无答案