diff options
-rw-r--r-- | lib/rbot/messagemapper.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/rbot/messagemapper.rb b/lib/rbot/messagemapper.rb index 9501ac59..1162a3a2 100644 --- a/lib/rbot/messagemapper.rb +++ b/lib/rbot/messagemapper.rb @@ -514,7 +514,9 @@ class Bot s = "#{not_needed ? "(?:" : ""}#{whites}(#{sub})#{ not_needed ? ")?" : ""}" } # debug "Replaced dyns: #{rx.inspect}" - rx.gsub!(/((?:\\ )*)\\\[/, "(?:\\1") + rx.gsub!(/((?:\\ )*)((?:\\\[)+)/, '\2\1') + # debug "Corrected optionals spacing: #{rx.inspect}" + rx.gsub!(/\\\[/, "(?:") rx.gsub!(/\\\]/, ")?") # debug "Delimited optionals: #{rx.inspect}" rx.gsub!(/(?:\\ )+/, "\\s+") |