#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?:\b(?:(kilogram\.*s*\.*|kg\.*s*\.*)(?:[^[:alnum:]])*)(?:\s*weight\s*)*(?:\s*is\s*|\s*are\s*)*)\W*([\d\.,]*\d+\b)|(?:(?:[\s\.]?|^)([\d\.,]*\d+)\W*(kilogram\.*s*\.*|kg\.*s*\.*)\b)"
Local $sString = "15kilograms fs s " & @CRLF & _
"kg 10 fe" & @CRLF & _
"something 10.5 kg-fef" & @CRLF & _
"" & @CRLF & _
"11.55kg gfre" & @CRLF & _
"11.55-kg gfre" & @CRLF & _
"11.55 kg gfre" & @CRLF & _
"kg 11.25 gre" & @CRLF & _
"efewf kg 11 fweew" & @CRLF & _
"ewsfewf kg" & @CRLF & _
"55 few" & @CRLF & _
"kg-55.55 dwd" & @CRLF & _
"eeewegv kg 55.55 ee" & @CRLF & _
"fewfewff 10" & @CRLF & _
"kg feeee" & @CRLF & _
"smth. .15kg ewfcwe" & @CRLF & _
"something kilogram weight is 15.5" & @CRLF & _
""
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