#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\d{3}-\d{4}"
Local $sString = "[Verse 1]" & @CRLF & _
"Jenny, Jenny, who can I turn to?" & @CRLF & _
"You give me somethin' I can hold on to" & @CRLF & _
"I know you think I'm like the others before" & @CRLF & _
"Who saw your name and number on the wall" & @CRLF & _
"" & @CRLF & _
"[Chorus 1]" & @CRLF & _
"Jenny, I got your number" & @CRLF & _
"I need to make you mine" & @CRLF & _
"Jenny, don't change your number" & @CRLF & _
"" & @CRLF & _
"[Post-Chorus]" & @CRLF & _
"867-5309" & @CRLF & _
"867-5309" & @CRLF & _
"867-5309" & @CRLF & _
"867-5309" & @CRLF & _
"" & @CRLF & _
"[Verse 2]" & @CRLF & _
"Jenny, Jenny, you're the girl for me" & @CRLF & _
"Oh, you don't know me, but you make me so happy" & @CRLF & _
"I tried to call you before, but I lost my nerve" & @CRLF & _
"I tried my imagination, but I was disturbed" & @CRLF & _
"" & @CRLF & _
"[Chorus 1]" & @CRLF & _
"Jenny, I got your number" & @CRLF & _
"I need to make you mine" & @CRLF & _
"Jenny, don't change your number" & @CRLF & _
"" & @CRLF & _
"[Post-Chorus]" & @CRLF & _
"867-5309" & @CRLF & _
"867-5309" & @CRLF & _
"867-5309" & @CRLF & _
"867-5309" & @CRLF & _
"" & @CRLF & _
"[Bridge]" & @CRLF & _
"I got it, (I got it), I got it" & @CRLF & _
"I got your number on the wall" & @CRLF & _
"I got it, (I got it), I got it" & @CRLF & _
"For a good time, for a good time call" & @CRLF & _
"" & @CRLF & _
"[Chorus 2]" & @CRLF & _
"Jenny, don't change your number" & @CRLF & _
"I need to make you mine" & @CRLF & _
"Jenny, I call your number" & @CRLF & _
"" & @CRLF & _
"[Post-Chorus]" & @CRLF & _
"867-5309" & @CRLF & _
"867-5309" & @CRLF & _
"867-5309" & @CRLF & _
"867-5309" & @CRLF & _
"" & @CRLF & _
"[Breakdown]" & @CRLF & _
"Jenny, Jenny, who can I turn to?" & @CRLF & _
"867-5309" & @CRLF & _
"For the price of a dime I can always turn to you" & @CRLF & _
"867-5309" & @CRLF & _
"" & @CRLF & _
"[Outro]" & @CRLF & _
"867-5309" & @CRLF & _
"867-5309" & @CRLF & _
"867-5309" & @CRLF & _
"867-5309" & @CRLF & _
"5309" & @CRLF & _
"867-5309 (5309)" & @CRLF & _
"867-5309 (5309)" & @CRLF & _
"867-5309"
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