#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?i).*(?:\d(?:\.\d+)?\s*x\s*)?\K(?<!\d)\d+(?:\.\d+)?(?:k?g|m?l)\b|(?<!\d)\d+(?:\.\d+)?(?:k?g|m?l)(?=\s*x\s*\d)"
Local $sString = "product brand A 1237ml Bundle of 6" & @CRLF & _
"product milk choc370ML" & @CRLF & _
"brand milk Vanilla Flavor 850g" & @CRLF & _
"One 2400g, For 0-6 Month-Old Infants" & @CRLF & _
"a+...two...6-12months...11.2kg...milk" & @CRLF & _
"a+...two...11.2kg 6-12months ..milk" & @CRLF & _
"Product 200g (10x2g)" & @CRLF & _
"[200g] Product" & @CRLF & _
"Product A brand(300g)" & @CRLF & _
"Product 200g (20g x 10)"
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