Regularization of hidden dynamics in piecewise smooth flows