Skip to content

Commit a781c75

Browse files
committed
improve a regex
>> re.sub(r'(@.*)\W', '', '@abc effff ') '' >> re.sub(r'(@.*?)\W', '', '@abc effff ') 'effff '
1 parent cc9fe59 commit a781c75

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

slack_bot/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def callback(kwargs, app):
5050
if isinstance(s, unicode):
5151
s = s.encode('utf-8')
5252
# remove metion block
53-
s = re.sub(r'(@.*)\W', '', s)
53+
s = re.sub(r'(@.*?)\W', '', s)
5454
private = any([word in s for word in ['private', '私聊']])
5555
attachmented = any([word in s for word in ['带图', '附件']])
5656
data = {

0 commit comments

Comments
 (0)