#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^..(.[!G)(3w^]|.{7}$|$)|\$\?"
Local $sString = "The next answer has to match the following strings:" & @CRLF & _
"" & @CRLF & _
"PPCG" & @CRLF & _
"^P" & @CRLF & _
"^[P^]P" & @CRLF & _
"[^?][PG]$" & @CRLF & _
"(?<!\\..)(?!]).$" & @CRLF & _
"^[\w^]*$|!|]P|G]\$$" & @CRLF & _
"!|[^?]P(CG|G..)?$" & @CRLF & _
"[^])]\$|^\^?P|P.\].$" & @CRLF & _
"([.$?]|G\])\$$|^\^?P|\]P$" & @CRLF & _
"([P.$?]\$|[]^]P|G\]\$|CG)$" & @CRLF & _
"!|((G.|P|\.)\$|[^?]P|CG)$" & @CRLF & _
"^[(!P]|G..$|]..\||[^?]P$" & @CRLF & _
"^.{3,23}[.-~]..\$$|[^P?][PG]$" & @CRLF & _
"" & @CRLF & _
"And fail on these strings:" & @CRLF & _
"" & @CRLF & _
"[PPCG]" & @CRLF & _
"^[P\^]" & @CRLF & _
"[^\]]$" & @CRLF & _
"^\^?P" & @CRLF & _
"[^?][PG]$|<|PG" & @CRLF & _
"^[^\\|]*(\\\\)+[^\\|]*[^\]]$" & @CRLF & _
"^(.{,4}|.{9}|.{16,19}|.{5}P)$" & @CRLF & _
"^[^?]*[PG]$|[?$].*\$$" & @CRLF & _
"^[^[]P|]P|(G]|[.])\$$" & @CRLF & _
"\..$|!|\|G|^[\^P]P|P\^|G.\$$" & @CRLF & _
"...\^.P|^!|G]\$$|w|<!|^\^?P" & @CRLF & _
"([^\\}<]{3}|][^]]|^).?[$PG]$" & @CRLF & _
"^(..[^^].{4,22}\$|[^?]+\w)$|2" & @CRLF & _
"^(..[^^].{4,22}\$|[^?]+\w)$|~"
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