#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mi)((?:\S+[\t\r\f ]*){1,3}).*"
Local $sString = "Examples of three words capture" & @CRLF & _
"2 3 5-trifenil tetrazolio cloruro" & @CRLF & _
"2-propanol para análisis emsure" & @CRLF & _
"2,6-diclorofenol indofenol (sal sódica) p.a." & @CRLF & _
"4 nitrofenil fosfato sal sódica" & @CRLF & _
"ablanda carnes" & @CRLF & _
"acaí en povo al 70%" & @CRLF & _
"aceite de almendras" & @CRLF & _
"aceite de canola en polvo" & @CRLF & _
"aceite de girasol" & @CRLF & _
"aceite de hierbabuena" & @CRLF & _
"aceite de inmersión" & @CRLF & _
"aceite de menta" & @CRLF & _
"aceite de naranja" & @CRLF & _
"aceite de parafina" & @CRLF & _
"aceite de romero" & @CRLF & _
"aceite esencial de árbol de té" & @CRLF & _
"aceite esencial de caléndula" & @CRLF & _
"aceite hidrosolubre de baobab" & @CRLF & _
"aceite mineral" & @CRLF & _
"aceite mineral con fragancia almendra"
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