#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?i)(\d*\.?\d+)\s*(?:tab|cap|grag|past|sob|comp)"
Local $sString = " PRODUCTS" & @CRLF & _
"0 PULSAR AT 20 MG ORAL 30 TAB RECUB" & @CRLF & _
"1 LIPITOR 40 MG 1+1 ORAL 15 TAB" & @CRLF & _
"2 LOFTYL 150 MG ORAL 30 TAB" & @CRLF & _
"3 SOMAZINA 500 MG ORAL 10 COMP RECUB" & @CRLF & _
"4 LOFTYL 30 TAB 150 MG ORAL"
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