匹配Python中的特定字符串,除非缺少给定的模式

2024-05-16 18:42:57 发布

您现在位置:Python中文网/ 问答频道 /正文

这个问题可能已经被问过了,但到目前为止我已经找到了解决办法。在

我想匹配包含inhibition(.+)toxicity的字符串,但我不想匹配growth inhibition(.+)toxicity。在

我尝试了(!?growth )inhibition(.+)toxicity,但它返回我要排除的字符串。但是,使用(!?growth)将返回除包含growth的字符串之外的所有内容。在

我不明白我对这个正则表达式做了什么错误。在

编辑:添加示例

我要加工的字符串:Inhibition of recombinant human TNF-alpha-induced cytotoxicity of mouse L929 cells

我不想匹配的字符串:Evaluated for the inhibitory concentration required to cause growth inhibition of A427Mer- cell line of lung using the MTT Cytotoxicity Assay


Tags: ofthe字符串编辑示例内容错误human