#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^[a-zA-Z]\d[a-zA-Z\d]\.?([a-zA-Z\d]{0,4})?$"
Local $sString = "# The regex should accept the modifier part of ICD10 codes, whether separated by a full stop or not" & @CRLF & _
"# Should be OK" & @CRLF & _
"V95.4" & @CRLF & _
"V97.33XA" & @CRLF & _
"V97.33XD" & @CRLF & _
"Y92.253" & @CRLF & _
"X96.2XXA" & @CRLF & _
"V95" & @CRLF & _
"V95." & @CRLF & _
"G711" & @CRLF & _
"G71.1" & @CRLF & _
"G71.1234" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"# Should fail" & @CRLF & _
"V9" & @CRLF & _
"A23.." & @CRLF & _
"C12.34567" & @CRLF & _
"/12.544" & @CRLF & _
"G7111234" & @CRLF & _
"" & @CRLF & _
""
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; 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