# File lib/json/editor.rb, line 988
 988:       def ask_for_find_term(search = nil)
 989:         dialog = Dialog.new(
 990:           "Find a node matching regex in tree.",
 991:           nil, nil,
 992:           [ Stock::OK, Dialog::RESPONSE_ACCEPT ],
 993:           [ Stock::CANCEL, Dialog::RESPONSE_REJECT ]
 994:         )
 995:         hbox = HBox.new(false, 5)
 996: 
 997:         hbox.pack_start(Label.new("Regex:"), false)
 998:         hbox.pack_start(regex_input = Entry.new)
 999:         hbox.pack_start(icase_checkbox = CheckButton.new('Icase'), false)
1000:         regex_input.width_chars = 60
1001:         if search
1002:           regex_input.text = search.source
1003:           icase_checkbox.active = search.casefold?
1004:         end
1005: 
1006:         dialog.vbox.pack_start(hbox, false)
1007: 
1008:         dialog.signal_connect('key-press-event''key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
1009:         dialog.show_all
1010:         self.focus = dialog
1011:         dialog.run do |response| 
1012:           if response == Dialog::RESPONSE_ACCEPT
1013:             begin
1014:               return Regexp.new(regex_input.text, icase_checkbox.active? ? Regexp::IGNORECASE : 0)
1015:             rescue => e
1016:               Editor.error_dialog(self, "Evaluation of regex /#{regex_input.text}/ failed: #{e}!")
1017:               return
1018:             end
1019:           end
1020:         end
1021:         return
1022:       ensure
1023:         dialog.destroy if dialog
1024:       end