Regular Expressions 101

Community Patterns

Detect Roman Numeral

1

Regular Expression
PCRE (PHP <7.3)

/
^([mM]{1,3})?([cC][mM]|[cC][dD]|[dD]?[cC]{1,3}|[dD])?([xX][cC]|[xX][lL]|[lL]?[xX]{1,3}|[lL])?([iI][xX]|[iI][vV]|[vV]?[iI]{1,3}|[vV])?$
/
gm

Description

Determines if the string is a roman numeral.

Submitted by anonymous - 4 years ago