Possible performance / matching issue

Feb 5, 2013 at 3:00 PM
Thank you for posting this C# project -- I've found it most useful. I couldn't help but notice the pattern matching for the regex seemed oddly slow, so I examined the pattern and found that the base pattern (fed into string.Format and resulting in 'addressPattern') has three main cases: one for APO/FPO/DPO addresses, one for PO boxes, and one for everything else. The first case (APOs and such) starts out with a carrot. The other two do not.

It seems somewhat bizarre to me that one address format must be at the start of a line or string where the other two do not have this requirement. Was this intentional?

I simply put carrots in front of the other two cases and the performance and behavior is as I'd expect.