Skip to content

Commit e357770

Browse files
authored
Merge pull request aichaos#71 from Dinh-Hung-Tu/whitespace
Feature tolerate the space between text and the weight tag.
2 parents b03380e + ab18030 commit e357770

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

rivescript/brain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def reply_regexp(self, user, regexp):
437437
regexp = regexp.replace('*', '(.+?)') # Convert * into (.+?)
438438
regexp = regexp.replace('#', '(\d+?)') # Convert # into (\d+?)
439439
regexp = regexp.replace('_', '(\w+?)') # Convert _ into (\w+?)
440-
regexp = re.sub(r'\{weight=\d+\}', '', regexp) # Remove {weight} tags
440+
regexp = re.sub(r'\s*\{weight=\d+\}', '', regexp) # Remove {weight} tags, allow spaces before the bracket
441441
regexp = regexp.replace('<zerowidthstar>', r'(.*?)')
442442

443443
# Optionals.

0 commit comments

Comments
 (0)