#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)r"
Local $sString = "Ex1. This is a random sentence.1,7,9 This is a sentence followed by it." & @CRLF & _
"Output = This is a random sentence. 1,7,9 This is a sentence followed by it.`#space after the period will do." & @CRLF & _
"Ex2. I love football.1,7,24`I also like cricket." & @CRLF & _
"Output = I love football. 1,7,24`I also like cricket." & @CRLF & _
"" & @CRLF & _
"Ex3. ESD for undifferentiated cancers.[1][7]Cancers can be treata" & @CRLF & _
"ble." & @CRLF & _
"Output = ESD for undifferentiated cancers. [1][7]Cancers can be treatable. #space after the period" & @CRLF & _
"" & @CRLF & _
"EX4. |Age, n (%) | | |< | |" & @CRLF & _
"| | | |0.001 | |" & @CRLF & _
"| |> 65 years |641 (44.3) |28 (24.8) | |669 (42.9)|" & @CRLF & _
"| |? 65 years |806 (55.7) |85 (75.2) | |891 (57.1)|" & @CRLF & _
"# Tables should be untouched" & @CRLF & _
"EX5.75.6% vs. 54.0% # untouched" & @CRLF & _
"" & @CRLF & _
"EX6. ask@to.in # should be untouched" & @CRLF & _
"" & @CRLF & _
"EX7. Decimal numbers 22.3456 # should be untouched" & @CRLF & _
"" & @CRLF & _
"EX8."
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