#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mi)^[\ \t]*(\S?(?:.*\S)?)?[\ \t]*$"
Local $sString = "The door swung open to reveal pink giraffes and red elephants. " & @CRLF & _
" He stomped on his fruit loops and thus became a cereal killer." & @CRLF & _
" Lightning Paradise was the local hangout joint where the ." & @CRLF & _
" " & @CRLF & _
" " & @CRLF & _
"a" & @CRLF & _
"sd" & @CRLF & _
"a " & @CRLF & _
"" & @CRLF & _
"He didn’t want to go to the dentist, yet he went anyway. " & @CRLF & _
"He decided to count all the sand on the beach as a hobby. " & @CRLF & _
" " & @CRLF & _
"" & @CRLF & _
"* Situps are a terrible way to end your day. " & @CRLF & _
"The random sentence generator generated a random sentence about a random sentence." & @CRLF & _
"As time wore on, . " & @CRLF & _
" The beach was crowded with snow leopards. " & @CRLF & _
" " & @CRLF & _
"She was too short to see over the fence." & @CRLF & _
"" & @CRLF & _
" " & @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