【发布时间】:2017-12-20 16:50:37
【问题描述】:
我正在使用以下正则表达式模式来识别缩写。
mytext = "This is AVGs and (NMN) and most importantly GFD"
mytext= re.sub(r"\b[A-Z\.]{2,}s?\b", "_ABB", mytext)
print(mytext)
我得到如下输出。
This is _ABB and (_ABB) and most importantly _ABB
但是,我想得到输出;
This is AVGs_ABB and (NMN_ABB) and most importantly GFD_ABB
请告诉我我哪里做错了。
【问题讨论】:
标签: python regex python-3.x