#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(\d*)( *)(x|\*)"
Local $sString = "500 g (4 x 125 g)" & @CRLF & _
"1,8 kg (20 * 90 g)" & @CRLF & _
"380 g (2 x 190 g)" & @CRLF & _
"1,6 kg (16 x 100 g)" & @CRLF & _
"1,6 kg (226x100 g)" & @CRLF & _
"8 x 100 g" & @CRLF & _
"2 l"
Local $sSubst = "$0"
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