I think I cheated and used an existing regex library - it's been a while.
As far as the 6 months, it was my first major, major project and required so much learning and research on just how to structure code that it took a long time to craft. It didn't help that the design was so complex that debugging it was a chore. :)
Hence the V2 rewrite that took a couple of days.