diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-03-27 21:13:37 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-03-27 21:13:37 +0100 |
commit | 63eaa1da3ba602e55458ad2228b8ecc9db045b04 (patch) | |
tree | 20bf6175954a2522912a7d28c576be11bc5cf2e0 /data | |
parent | 95968ce9b07a35cf0c196491c4e050150e556bea (diff) |
factoids plugin: fix regexp for words such as jsn-
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/factoids.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/data/rbot/plugins/factoids.rb b/data/rbot/plugins/factoids.rb index aeb6557f..3192aa00 100644 --- a/data/rbot/plugins/factoids.rb +++ b/data/rbot/plugins/factoids.rb @@ -331,7 +331,9 @@ class FactoidsPlugin < Plugin # When looking for words we separate them with # arbitrary whitespace, not whatever they came with pre = words.map { |w| Regexp.escape(w)}.join("\\s+") - return Regexp.new("\\b#{pre}\\b", true) + pre << '\b' if pre.match(/\b$/) + pre = '\b' + pre if pre.match(/^\b/) + return Regexp.new(pre, true) end def facts(m, params) |