#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?=(?:\d,?){1,10}(?:\.\d{2})?$)[0-9]{1,3}(?:,[0-9]{3})*(?:\.[0-9]+)?$"
Local $sString = "I want to make sure that the input is no more than 10 digits before the decimals point so it will match DECIMAL(12,2)." & @CRLF & _
"" & @CRLF & _
"I already tried :" & @CRLF & _
"" & @CRLF & _
"^(?=.{0,13}$)[0-9]{1,3}(,[0-9]{3})*(\.[0-9]+)?$" & @CRLF & _
"But it counts the digits after decimals too, so what I want to match is:" & @CRLF & _
"" & @CRLF & _
"1,111,111,111.00" & @CRLF & _
"" & @CRLF & _
"so it will keep matching with or without the decimals, what I tried only can match with:" & @CRLF & _
"" & @CRLF & _
"1,111,111,111" & @CRLF & _
"" & @CRLF & _
"111,111,111.00" & @CRLF & _
"" & @CRLF & _
"1,111,111,111,1.00"
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