pattern = r"(?P<sender>[\w\s]+) said to (?P<recipient>[\w\s]+): [\"'](?P<message>.*)[\"']"
I've got messages which are addressed to "everyone in location", which breaks this regex, as it doesn't expect recipient to have whitespace in it. This causes the sender_name, recipient, content = re.findall(pattern, event.description)[0] to explode
Adding .* to the regex to allow the recipient to have spaces in it makes it work, though I'm not sure it wont break something else
With the .* added: pattern = r"(?P<sender>[\w\s]+) said to (?P<recipient>[\w\s]+.*): [\"'](?P<message>.*)[\"']"
pattern = r"(?P<sender>[\w\s]+) said to (?P<recipient>[\w\s]+): [\"'](?P<message>.*)[\"']"
I've got messages which are addressed to "everyone in location", which breaks this regex, as it doesn't expect recipient to have whitespace in it. This causes the
sender_name, recipient, content = re.findall(pattern, event.description)[0]
to explodeAdding
.*
to the regex to allow the recipient to have spaces in it makes it work, though I'm not sure it wont break something elseWith the
.*
added:pattern = r"(?P<sender>[\w\s]+) said to (?P<recipient>[\w\s]+.*): [\"'](?P<message>.*)[\"']"