I want to match a string for which the string elements should contain specific characters only:
- First character from [A,C,K,M,F]
- Followed by a number (float or integer). Allowed instances: 1,2.5,3.6,9,0,6.3 etc.
- Ending at either of these roman numerals [I, II, III, IV, V].
The regex that I am supplying is the following
bool(re.match(r'(A|C|K|M|F){1}\d+\.?\d?(I|II|III|IV|V)$', test_str))
"(I|II|III|IV|V)"
part will return true for test_str='C5.3IV'
but I want to make it true even if two of the roman numerals are present at the same time with a delimiter /
i.e. the regex query should retrun true for test_str='C5.3IV/V'
also.
How should I modify the regex?
Thanks