In an effort to make sure I matched the behavior of os.MkdirAll, I copied the implementation from there.  I could improve it later, but for now I'd like to make it a clear equivalent with just the extra regexp at the top. 