#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?mi)(?=\b[MCDXLVI]{1,6}\b)M{0,4}(?:CM|CD|D?C{0,3})(?:XC|XL|L?X{0,3})(?:IX|IV|V?I{0,3})"
Local $sString = "Act IX: The End" & @CRLF & _
"Act iX: The End" & @CRLF & _
"Act Ix: The End" & @CRLF & _
"Act ix: The End" & @CRLF & _
"Act IX : The End" & @CRLF & _
"Act iX : The End" & @CRLF & _
"Act Ix : The End" & @CRLF & _
"Act ix : The End" & @CRLF & _
"i also me" & @CRLF & _
"only ii two" & @CRLF & _
"the iii three" & @CRLF & _
"what about iv" & @CRLF & _
"" & @CRLF & _
"I" & @CRLF & _
"II" & @CRLF & _
"III" & @CRLF & _
"IV" & @CRLF & _
"V" & @CRLF & _
"VI" & @CRLF & _
"VII" & @CRLF & _
"VIII" & @CRLF & _
"IX" & @CRLF & _
"X" & @CRLF & _
"XI" & @CRLF & _
"XII" & @CRLF & _
"XIII" & @CRLF & _
"XIV" & @CRLF & _
"XV" & @CRLF & _
"XVI" & @CRLF & _
"XVII" & @CRLF & _
"XVIII" & @CRLF & _
"XIX" & @CRLF & _
"XX" & @CRLF & _
"XLIV" & @CRLF & _
"XLIX" & @CRLF & _
"LXXIX" & @CRLF & _
"XCIV" & @CRLF & _
"XCIX" & @CRLF & _
"C" & @CRLF & _
"CI" & @CRLF & _
"CII" & @CRLF & _
"CIII" & @CRLF & _
"CIV" & @CRLF & _
"CVI" & @CRLF & _
"CIX" & @CRLF & _
"CD" & @CRLF & _
"CM" & @CRLF & _
"CC" & @CRLF & _
"CCC" & @CRLF & _
"D" & @CRLF & _
"DC" & @CRLF & _
"DCC" & @CRLF & _
"DCCC" & @CRLF & _
"CX" & @CRLF & _
"CXX" & @CRLF & _
"CXIX" & @CRLF & _
"CMXCIX" & @CRLF & _
""
Local $sSubst = "\U$0"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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