diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2018-11-06 01:13:17 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-05-07 19:42:58 +0200 |
commit | 3ab0be86bf7c49b423cbd1063dac431080bb12a6 (patch) | |
tree | 0f21093b10c8cd613a5c11a98fa26a00da5ed35c /wee_slack.py | |
parent | 98178846ce658fa4d89a7bf8d63cb98867ea2acc (diff) | |
download | wee-slack-3ab0be86bf7c49b423cbd1063dac431080bb12a6.tar.gz |
Support regex flags i, m and s
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py index d643903..4c4e0f4 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1381,7 +1381,11 @@ class SlackChannelCommon(object): num_replace = 1 if 'g' in flags: num_replace = 0 - new_message = re.sub(old, new, message["text"], num_replace) + f = re.UNICODE + f |= re.IGNORECASE if 'i' in flags else 0 + f |= re.MULTILINE if 'm' in flags else 0 + f |= re.DOTALL if 's' in flags else 0 + new_message = re.sub(old, new, message["text"], num_replace, f) if new_message != message["text"]: s = SlackRequest(self.team.token, "chat.update", {"channel": self.identifier, "ts": message['ts'], "text": new_message}, team_hash=self.team.team_hash, channel_identifier=self.identifier) self.eventrouter.receive(s) |