    # File lib/rbot/messagemapper.rb, line 484
        def regexp=(str)
          # debug "Original string: #{str.inspect}"
          rx = Regexp.escape(str)
          # debug "Escaped: #{rx.inspect}"
          rx.gsub!(/((?:\\ )*)(:|\\\*)(\w+)/) { |m|
            whites = $1
            is_single = $2 == ":"
            name = $3.intern

            not_needed = @defaults.has_key?(name)

            has_req = @requirements[name]
            debug "Requirements for #{name}: #{has_req.inspect}"
            case has_req
            when nil
              sub = is_single ? "\\S+" : ".*?"
            when Regexp
              # Remove captures and the ^ and $ that are sometimes placed in requirement regexps
              sub = has_req.mm_cleanup
            when String
              sub = Regexp.escape(has_req)
            when Array
              sub = has_req[0].mm_cleanup
            when Hash
              sub = has_req[:regexp].mm_cleanup
            else
              warning "Odd requirement #{has_req.inspect} of class #{has_req.class} for parameter '#{name}'"
              sub = Regexp.escape(has_req.to_s) rescue "\\S+"
            end
            debug "Regexp for #{name}: #{sub.inspect}"
            s = "#{not_needed ? "(?:" : ""}#{whites}(#{sub})#{ not_needed ? ")?" : ""}"
          }
          # debug "Replaced dyns: #{rx.inspect}"
          rx.gsub!(/((?:\\ )*)\\\[/, "(?:\\1")
          rx.gsub!(/\\\]/, ")?")
          # debug "Delimited optionals: #{rx.inspect}"
          rx.gsub!(/(?:\\ )+/, "\\s+")
          # debug "Corrected spaces: #{rx.inspect}"
          # Created message (such as by fake_message) can contain multiple lines
          @regexp = /\A#{rx}\z/m
        end