You are viewing a single comment's thread. Return to all comments →
Interesting problem, and I learned a fine point or two about Roman numerals. :)
My solution is a little different in that I didn't use any | alternatives:
regex_pattern = r"^M{0,3}(CM)?(C?D)?C{0,3}(XC)?(X?L)?X{0,3}(IX)?(I?V)?I{0,3}$"
Seems like cookies are disabled on this browser, please enable them to open this website
Validating Roman Numerals
You are viewing a single comment's thread. Return to all comments →
Interesting problem, and I learned a fine point or two about Roman numerals. :)
My solution is a little different in that I didn't use any | alternatives:
regex_pattern = r"^M{0,3}(CM)?(C?D)?C{0,3}(XC)?(X?L)?X{0,3}(IX)?(I?V)?I{0,3}$"