posted 6 years ago
I'm not sure I would write a regex for that. It would depend on whether the requirements were likely to change. It might happen that I spent a couple of hours writing that regex and setting up unit tests for it, and then two months later they changed it to "R2-R237". In this case changing the non-regex code I have in mind would be pretty trivial, but writing a new regex for that rule might be less than trivial.