#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^"(product\stype[1234]\(\d+(?:\.\d+)?\))\s*(:.*?)?"$"
Local $sString = ""product type1(0)"" & @CRLF & _
""product type2(923)"" & @CRLF & _
""product type3(10)"" & @CRLF & _
""product type4(110.023) :here is a comment. It always starts with a semicolon"" & @CRLF & _
""product type1(14.4):comments can be just after product entry"" & @CRLF & _
""product type1(10.0) : spaces are not relevant"" & @CRLF & _
""product type1(0000.01) : this kind of entry is acceptable"" & @CRLF & _
"" & @CRLF & _
""product type1(asd)"" & @CRLF & _
""product type1(12a3.02)" " & @CRLF & _
""product type2(0.)"" & @CRLF & _
""product type2(0.123.123)"" & @CRLF & _
""product type2(0...)"" & @CRLF & _
""product type3(0.asd)"" & @CRLF & _
""product type4(10)" comment doesn't start with a semicolon" & @CRLF & _
""
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