#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?:FN:Tom )((.|\n)*)(?:\nEND:VCARD)"
Local $sString = "FN:Tom root:x:0:0:root:/root:/bin/bash" & @CRLF & _
"daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin" & @CRLF & _
"bin:x:2:2:bin:/bin:/usr/sbin/nologin" & @CRLF & _
"sys:x:3:3:sys:/dev:/usr/sbin/nologin" & @CRLF & _
"sync:x:4:65534:sync:/bin:/bin/sync" & @CRLF & _
"games:x:5:60:games:/usr/games:/usr/sbin/nologin" & @CRLF & _
"man:x:6:12:man:/var/cache/man:/usr/sbin/nologin" & @CRLF & _
"lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin" & @CRLF & _
"mail:x:8:8:mail:/var/mail:/usr/sbin/nologin" & @CRLF & _
"news:x:9:9:news:/var/spool/news:/usr/sbin/nologin" & @CRLF & _
"uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin" & @CRLF & _
"proxy:x:13:13:proxy:/bin:/usr/sbin/nologin" & @CRLF & _
"www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin" & @CRLF & _
"backup:x:34:34:backup:/var/backups:/usr/sbin/nologin" & @CRLF & _
"list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin" & @CRLF & _
"irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin" & @CRLF & _
"gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin" & @CRLF & _
"nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin" & @CRLF & _
"systemd-timesync:x:100:102:systemd Time Synchronization,,,:/run/systemd:/bin/false" & @CRLF & _
"systemd-network:x:101:103:systemd Network Management,,,:/run/systemd/netif:/bin/false" & @CRLF & _
"systemd-resolve:x:102:104:systemd Resolver,,,:/run/systemd/resolve:/bin/false" & @CRLF & _
"systemd-bus-proxy:x:103:105:systemd Bus Proxy,,,:/run/systemd:/bin/false" & @CRLF & _
"syslog:x:104:108::/home/syslog:/bin/false" & @CRLF & _
"_apt:x:105:65534::/nonexistent:/bin/false" & @CRLF & _
"messagebus:x:106:110::/var/run/dbus:/bin/false" & @CRLF & _
"uuidd:x:107:111::/run/uuidd:/bin/false" & @CRLF & _
"student:x:1000:1000:student,,,:/home/student:/bin/bash" & @CRLF & _
"sshd:x:108:65534::/var/run/sshd:/usr/sbin/nologin" & @CRLF & _
"" & @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