# File lib/json/editor.rb, line 997
      def ask_for_find_term(search = nil)
        dialog = Dialog.new(
          "Find a node matching regex in tree.",
          nil, nil,
          [ Stock::OK, Dialog::RESPONSE_ACCEPT ],
          [ Stock::CANCEL, Dialog::RESPONSE_REJECT ]
        )
        hbox = HBox.new(false, 5)

        hbox.pack_start(Label.new("Regex:"), false)
        hbox.pack_start(regex_input = Entry.new)
        hbox.pack_start(icase_checkbox = CheckButton.new('Icase'), false)
        regex_input.width_chars = 60
        if search
          regex_input.text = search.source
          icase_checkbox.active = search.casefold?
        end

        dialog.vbox.pack_start(hbox, false)

        dialog.signal_connect('key-press-event''key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
        dialog.show_all
        self.focus = dialog
        dialog.run do |response| 
          if response == Dialog::RESPONSE_ACCEPT
            begin
              return Regexp.new(regex_input.text, icase_checkbox.active? ? Regexp::IGNORECASE : 0)
            rescue => e
              Editor.error_dialog(self, "Evaluation of regex /#{regex_input.text}/ failed: #{e}!")
              return
            end
          end
        end
        return
      ensure
        dialog.destroy if dialog
      end