diff options
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/reaction.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/data/rbot/plugins/reaction.rb b/data/rbot/plugins/reaction.rb index 55fabcdb..8f2a1637 100644 --- a/data/rbot/plugins/reaction.rb +++ b/data/rbot/plugins/reaction.rb @@ -69,7 +69,9 @@ class ::Reaction @trigger << Regexp.new(rex, true) else rex.sub!(/^(["'])(.*)\1$/, '\2') - @trigger << Regexp.new(/\b#{Regexp.escape(rex)}(?:\b|$)/ui) + prepend = ( rex =~ /^\w/ ? '(?:\b)' : '') + append = ( rex =~ /\w$/ ? '(?:\b|$)' : '') + @trigger << Regexp.new(/#{prepend}#{Regexp.escape(rex)}#{append}/ui) end end |