Word boundary with regex - cannot extract all words
问题 I need extract double Male-Cat : a = "Male-Cat Male-Cat Male-Cat-Female" b = re.findall(r'(?:\s|^)Male-Cat(?:\s|$)', a) print (b) ['Male-Cat '] c = re.findall(r'\bMale-Cat\b', a) print (c) ['Male-Cat', 'Male-Cat', 'Male-Cat'] I need extract tree times Male-Cat : a = "Male-Cat Male-Cat Male-Cat" b = re.findall(r'(?:\s|^)Male-Cat(?:\s|$)', a) print (b) ['Male-Cat ', ' Male-Cat'] c = re.findall(r'\bMale-Cat\b', a) print (c) ['Male-Cat', 'Male-Cat', 'Male-Cat'] Another strings which are parsed