#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^(-?(?=\d{1,15}(?:[.,]0+)?0*$|(?:(?=[,.\d]{1,16}0*$)(?:\d+[.,]\d{1,2}$))).{1,16}).*$|^.*$"
Local $sString = "// PASS" & @CRLF & _
"0" & @CRLF & _
"0.12" & @CRLF & _
"1" & @CRLF & _
"-1" & @CRLF & _
"1.23456789012345" & @CRLF & _
"10.2345678901234" & @CRLF & _
"12.3456789012345" & @CRLF & _
"-123.4" & @CRLF & _
"-12.34" & @CRLF & _
"-1,33" & @CRLF & _
"-1.33" & @CRLF & _
"-1.333" & @CRLF & _
"-1234567.12" & @CRLF & _
"-1234567890123450" & @CRLF & _
"-12345678901234.50" & @CRLF & _
"12345678901234.50" & @CRLF & _
"123456789012345.00" & @CRLF & _
"" & @CRLF & _
"// FAIL" & @CRLF & _
"-1234567890123456" & @CRLF & _
"-12345678901234.56" & @CRLF & _
"12345678901234.56" & @CRLF & _
"123456789012345.60" & @CRLF & _
"1.234567890123456" & @CRLF & _
"12.34567890123456" & @CRLF & _
"123456789012340.6" & @CRLF & _
"123456789012300.67" & @CRLF & _
"123456789012300000000000.67" & @CRLF & _
"10000000000010000000001000010000000001.22"
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