def METHOD_NAME(self):
    prog = self.engine.getprog()
    if not prog:
        return False
    text = self.text
    try:
        first = pos = text.index("sel.first")
        last = text.index("sel.last")
    except TclError:
        pos = None
    if not pos:
        first = last = pos = text.index("insert")
    line, col = SearchEngine.get_line_col(pos)
    chars = text.get("%d.0" % line, "%d.0" % (line+1))
    m = prog.match(chars, col)
    if not prog:
        return False
    new = self._replace_expand(m, self.replvar.get())
    if new is None:
        return False
    text.mark_set("insert", first)
    text.undo_block_start()
    if m.group():
        text.delete(first, last)
    if new:
        text.insert(first, new)
    text.undo_block_stop()
    self.show_hit(first, text.index("insert"))
    self.ok = 0
    return True