#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(BEGIN:VCARD([\s\S]*?)END:VCARD)"
Local $sString = "BEGIN:VCARD" & @CRLF & _
"VERSION:3.0" & @CRLF & _
"N:Doe;John;;;" & @CRLF & _
"FN:John Doe" & @CRLF & _
"ORG:Example.com Inc.;" & @CRLF & _
"TITLE:Imaginary test person" & @CRLF & _
"EMAIL;type=INTERNET;type=WORK;type=pref:johnDoe@example.org" & @CRLF & _
"TEL;type=WORK;type=pref:+1 617 555 1212" & @CRLF & _
"TEL;type=WORK:+1 (617) 555-1234" & @CRLF & _
"TEL;type=CELL:+1 781 555 1212" & @CRLF & _
"TEL;type=HOME:+1 202 555 1212" & @CRLF & _
"NOTE:John Doe has a long and varied history\, being documented on more police files that anyone else. Reports of his death are alas numerous." & @CRLF & _
"CATEGORIES:Work,Test group" & @CRLF & _
"X-ABUID:5AD380FD-B2DE-4261-BA99-DE1D1DB52FBE\:ABPerson" & @CRLF & _
"END:VCARD" & @CRLF & _
"BEGIN:VCARD" & @CRLF & _
"VERSION:3.0" & @CRLF & _
"N:Doe;Jane;;;" & @CRLF & _
"FN:Jane Doe" & @CRLF & _
"ORG:Example.com Inc.;" & @CRLF & _
"TITLE:Another Imaginary test person" & @CRLF & _
"EMAIL;type=INTERNET;type=WORK;type=pref:johnDoe@example.org" & @CRLF & _
"TEL;type=WORK;type=pref:+1 617 555 1213" & @CRLF & _
"TEL;type=WORK:+1 (617) 555-1233" & @CRLF & _
"TEL;type=CELL:+1 781 555 1213" & @CRLF & _
"TEL;type=HOME:+1 202 555 1213" & @CRLF & _
"NOTE:Jane Doe has a long and varied history\, being documented on more police files that anyone else. Reports of her death are alas numerous." & @CRLF & _
"CATEGORIES:Work,Test group" & @CRLF & _
"X-ABUID:5AD380FD-B2DE-4261-BA99-DE1D1DB52FBE\:ABPerson" & @CRLF & _
"END:VCARD"
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