#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "^(?!$)M{0,2}(?:M(?=CM(?:XC)?(?:IX)?$))?(?:C(?=M[^CD]*(?:XC)?[^CD]*$))?M?(?:C(?=D[^C]*(?:XC)?[^C]*$))?D?C{0,2}(?:C(?=XC(?:IX)?$))?(?:X(?=C[^X]*(?:IX)?[^X]*$)(?!.*L))?C?(?:X(?=L[^X]*(?:IX)?[^X]*$))?L?X{0,2}(?:X(?=IX$))?(?:I(?=[XV]$))?X?V?I{0,3}$"
Local $sString = "I" & @CRLF & _
"II" & @CRLF & _
"XXIX" & @CRLF & _
"XXXVIII" & @CRLF & _
"IV" & @CRLF & _
"XIV" & @CRLF & _
"XXXIX" & @CRLF & _
"LXXX" & @CRLF & _
"XL" & @CRLF & _
"CCCXCIX" & @CRLF & _
"DCCCXCIX" & @CRLF & _
"CDXC" & @CRLF & _
"MMMCMIX" & @CRLF & _
"MMMCMXCIX" & @CRLF & _
"MMMCM" & @CRLF & _
"(MMMCM)CMI" & @CRLF & _
"(I)"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; Present the entire match result
_ArrayDisplay($aArray, "Result")
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm