Many economic situations involve the timing of irreversible decisions. E.g. People decide when to sell a stock or stop searching for a better price. We analyze the behavior of a decision maker who evaluates his choice relative to the ex-post optimal choice in an optimal stopping task. We derive the optimal strategy under such regret preferences, and show how it is different from that of an expected utility maximizer. We also show that if the decision maker never commits mistakes the behavior resulting from this strategy is observationally equivalent to that of an expected utility maximizer. We then test our theoretical predictions in the laboratory. The results from a structural discrete choice model we fit to our data provide strong evidence that many people's stopping behavior is largely determined by the anticipation of and aversion to regret.