Taking the following string as an input example
Post-Match Thread: Barcelona - Olimpia Milano [EuroLeague Regular Season, Round 24]
The goal is to get the home team, the away team and the competition in hand. In this case, that would be Barcelona, Olimpia Milano and EuroLeague, respectively. When trying to use the group function, I was able to retrieve both teams just fine (even if a strip() call was necessary) but for some reason the current regular expression is not able to get the competition. Several options were tried, with the current iteration being the following:
title_group_regex = r"Post-Match Thread: (?P<home_team>(.*?))-(?P<away_team>(.*?))\[(?P<competition>(.*?))\b"
title_group = re.search(title_group_regex, thread_title)
In this attempt, I was attempting to match anything after the [ char up until a word boundary. However this results in AttributeError: 'NoneType' object has no attribute 'group'. I imagine I'm close but lacking that final touch. Thank you.