如何使 \b 正确尊重单词边界?例如,理解 ' 并且不进行部分匹配...
>>> import re >>> str = "This is a test's test" >>> p1 = r'\b' + 'test' + r'\b' >>> re.findall(p1,str) ['test', 'test']
python regex string
python ×1
regex ×1
string ×1