We investigate an optimal refinancing problem for an interest-only mortgage, where the market mortgage rate is defined as the classical Black-Scholes geometric Brownian motion with regime switching. We verify that the optimal refinancing strategy only depends on the quotient between the market mortgage rate and the borrowing rate. We show that the optimal refinancing strategy is of threshold type. By reducing the two-dimensional optimal refinancing problem to a one-dimensional problem, we obtain the system of equations that the function with respect to quotient satisfies. Analytic solutions are obtained in one-and two-regime cases. Finally, we present some numerical results to illustrate the influence of the model parameters on the optimal refinancing strategy.