#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^\(([\da-z])\)"
Local $sString = "Lorem ipsum dolor sit amet," & @CRLF & _
"" & @CRLF & _
"(1)consectetur adipiscing elit, sed do eiusmod tempor incididunt" & @CRLF & _
"" & @CRLF & _
"(2)ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip" & @CRLF & _
"" & @CRLF & _
"(a) ex ea (commodo consequat). Duis aute irure dolor in (reprehenderit) in voluptate velit esse cillum dolore eu" & @CRLF & _
"" & @CRLF & _
"(b) fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
Local $sSubst = "\1. "
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