The link below has a good solution and explanation

regex - How do you match only valid roman numerals with a regular expression? - Stack Overflow