I'm trying to write a regex to match both regular numbers (1, 2, 42...) and roman ones (X, VII...).
But the one I've currently wrote:
\b((?=[MDCLXVI])M{0,3}(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3}))\b|\b\d+\b
is matching more than expected. It has 9 matches, while I expect only 4:
- XII
- VII
- 2
- 12
How can I fix it?