only match on word boundaries at an end of a trigger if the character at
that end of the trigger is a word character. In other words, the
trigger "test" should require word boundaries on each side, but the
trigger "@test" should only require one on the right side.
@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