#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?<title>.+)\s+(?<text>[\w\W]+?)\s*(?:---|$)"
Local $sString = "Automation Anxiety: Is Your Job Safe?" & @CRLF & _
"" & @CRLF & _
"Many worry that AI will take over human jobs. However, the reality is more complex than simple replacement." & @CRLF & _
"" & @CRLF & _
"---" & @CRLF & _
"" & @CRLF & _
"AI Will Disrupt Jobs, But Create New Ones" & @CRLF & _
"" & @CRLF & _
"A shift is coming where many roles may be displaced. But new opportunities will also arise, balancing the job market." & @CRLF & _
"" & @CRLF & _
"---" & @CRLF & _
"" & @CRLF & _
"AI Augments Human Potential" & @CRLF & _
"" & @CRLF & _
"Instead of replacing individuals, AI enhances our work capabilities. It allows us to focus on creative and complex tasks that require human insight." & @CRLF & _
"" & @CRLF & _
"---" & @CRLF & _
"" & @CRLF & _
"New Industries Will Emerge" & @CRLF & _
"" & @CRLF & _
"The growth of AI will lead to unprecedented job opportunities. Fields like data science and machine learning will see increasing demand." & @CRLF & _
"" & @CRLF & _
"---" & @CRLF & _
"" & @CRLF & _
"Prepare Yourself for an AI Future" & @CRLF & _
"" & @CRLF & _
"Upskilling is essential to remain relevant in a changing job landscape. Emphasizing human skills like empathy and creativity will provide a competitive edge." & @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