ENH: Exposed pattern->regex API. Cleaned up and commented implementation of pattern->regex conversion.