#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?P<category>\D+)\s+(?P<value>[\d.]+)\s+(?P<unit>.+)"
Local $sString = "Weight 229.6104534866 g" & @CRLF & _
"Energy 374.79170898476 kcal" & @CRLF & _
"Total lipid (fat) 22.163422468932 g" & @CRLF & _
"Carbohydrate, by difference 13.641848209743 g" & @CRLF & _
"Sugars, total 4.3691034101428 g" & @CRLF & _
"Protein 29.256342349938 g" & @CRLF & _
"Sodium, Na 468.99386390008 mg "
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