0

Anyone ideas why I can not get a match here?

text = "Here is the SKU \nT-shirt 101 (*)"
string_to_find = 'T-shirt 101 (*)'
pat = re.compile(fr'\b{re.escape(string_to_find)}\b')
for match in re.finditer(pat, text):
    print(match)

Return None
Expected result: <re.Match object; span=(17, 32), match='T-shirt 101 (*)'>

Quy Dinh
  • 31
  • 4

0 Answers0