For the general case, regex matching simply will not do. The regex becomes so hairy so it turns write-only, i.e. unmaintainable. Regex matching is also slower than a handwritten custom parser.