#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?s)(?:([A-Z]+ *[A-Z]+)\n).*?(?=$|([A-Z]+ *[A-Z]+)\n)"
Local $sString = " ADAM ASS" & @CRLF & _
" Help! Someone help me! (He stops when " & @CRLF & _
" he hears a loud dragging sound somewhere " & @CRLF & _
" in the room. He looks out into the darkness " & @CRLF & _
" and calls out.) Is someone there? Hey! " & @CRLF & _
" (He turns back to the corner to which " & @CRLF & _
" he is chained, says in a slightly softer " & @CRLF & _
" but still panicked voice) Shit, Im " & @CRLF & _
" probably dead." & @CRLF & _
"" & @CRLF & _
" Suddenly, from out within the darkness comes a mans low, raspy " & @CRLF & _
" voice. It startles Adam. The voice, we will soon learn, belongs " & @CRLF & _
" to LAWRENCE." & @CRLF & _
"" & @CRLF & _
" LAWRENCE" & @CRLF & _
" Youre not dead." & @CRLF & _
"" & @CRLF & _
" Adam quickly turns in the direction of the voice. Holding his " & @CRLF & _
" arms out for balance, he tries to look across the room to whoever " & @CRLF & _
" is speaking, but still cannot see a thing." & @CRLF & _
"" & @CRLF & _
" ADAM" & @CRLF & _
" Whos that? Whos that?!" & @CRLF & _
"" & @CRLF & _
" LAWRENCE" & @CRLF & _
" (his voice strangely a bit on the calm " & @CRLF & _
" side, and almost irritated with Adams " & @CRLF & _
" reaction to the situation. This shall " & @CRLF & _
" be his tone for many scenes to come.) " & @CRLF & _
" Theres no point in yelling, I already " & @CRLF & _
" tried it." & @CRLF & _
"" & @CRLF & _
" ADAM" & @CRLF & _
" Turn on the lights!" & @CRLF & _
"" & @CRLF & _
" LAWRENCE" & @CRLF & _
" Would if I could." & @CRLF & _
"" & @CRLF & _
" ADAM" & @CRLF & _
" What the fuck is going on? Where am " & @CRLF & _
" I? (He turns into his corner, touching " & @CRLF & _
" the wall.)" & @CRLF & _
"" & @CRLF & _
" LAWRENCE" & @CRLF & _
" I dont know yet." & @CRLF & _
"" & @CRLF & _
" ADAM" & @CRLF & _
" (smelling something; in disgust) What " & @CRLF & _
" is that smell?" & @CRLF & _
"" & @CRLF & _
" LAWRENCE" & @CRLF & _
" Shh! Hang on a second, I think I found " & @CRLF & _
" something." & @CRLF & _
"" & @CRLF & _
" With a loud click and an even louder buzzing sound, the very " & @CRLF & _
" bright fluorescent lights come to life, lighting up in rows, " & @CRLF & _
" starting from Lawrences end and moving towards Adam. As they " & @CRLF & _
" come on, Adam is nearly blinded by the sudden change from pitch " & @CRLF & _
" black to bright white and squints in pain, holding up his arms " & @CRLF & _
" to cover his face. In the light we now see that he is in his " & @CRLF & _
" mid-twenties, with short brown hair, wearing a dark blue striped " & @CRLF & _
" shirt over a white tee shirt and jeans, looking like a drowned " & @CRLF & _
" rat from the tub. It takes him a moment but his eyes finally " & @CRLF & _
" start to adjust, and he looks around the room. He and we see " & @CRLF & _
" Lawrence, who also winces from the glare of the lights, standing " & @CRLF & _
" by the light switch and the door. He is on the opposite end of " & @CRLF & _
" the room, also chained to a pipe in the corner by his foot. He " & @CRLF & _
" wears a blue button-down dress shirt, now soaked with sweat stains. " & @CRLF & _
" He is middle aged, mid to late forties, with pale blonde hair " & @CRLF & _
" and even paler skin. Dark circles are under his eyes. Both men " & @CRLF & _
" are barefoot." & @CRLF & _
"" & @CRLF & _
" Lawrences eyes adjust to the light and he sees across the room. " & @CRLF & _
" Then, his gaze starts towards the center of the room, as does " & @CRLF & _
" Adams, who steps forward as much as he can, a look of horror " & @CRLF & _
" on his face. We see lying face down the body of a man who has " & @CRLF & _
" blown his brains out, lying in a pool of blood, clad in only " & @CRLF & _
" boxer shorts and a tee shirt. In his left hand is a gun, in his " & @CRLF & _
" right hand is a micro cassette recorder. A gunshot and a scream " & @CRLF & _
" are heard as the camera moves up and in a fast 360° angle above " & @CRLF & _
" and circling the man, ending in a full overhead view of him." & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
" The shot cuts to Adam, who reels in shock and disgust." & @CRLF & _
"" & @CRLF & _
" ADAM" & @CRLF & _
" Holy shit!" & @CRLF & _
"" & @CRLF & _
" He turns towards the tub and leans over, gagging and coughing. " & @CRLF & _
" Lawrence in the meantime hops forward the best he can, studying " & @CRLF & _
" the body with a look of fear and concern. Adam stops coughing " & @CRLF & _
" and turns back around, takes another look at the body and around " & @CRLF & _
" the room. He looks down at his chain then starts to completely " & @CRLF & _
" freak out, grabbing and pulling at his chain." & @CRLF & _
"" & @CRLF & _
" ADAM" & @CRLF & _
" (screaming) HELP!!! (He falls back onto " & @CRLF & _
" his bottom on the floor as he yanks " & @CRLF & _
" at the chain as hard as he can.) HELP!!! " & @CRLF & _
" Help!" & @CRLF & _
"" & @CRLF & _
" Lawrence just stands and watches him with an almost embarrassed, " & @CRLF & _
" appalled look at his behaviour. It seems that Lawrence, despite " & @CRLF & _
" being in the situation hes in, is above that kind of uncontrolled " & @CRLF & _
" reaction. He speaks a bit coldly." & @CRLF & _
"" & @CRLF & _
" LAWRENCE SANDLER" & @CRLF & _
" No one can hear you."
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