#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?s)\[IF\s#(!)?([^\#]+)\#\](.*)(?:\[ELSE](.*))?\[\/IF]"
Local $sString = "#QST_COUPLE="Me contacter vous pour un problème de couple ?"#" & @CRLF & _
"[IF #COUPLE#]" & @CRLF & _
"[IF #!PRENOM_PARTENAIRE#]" & @CRLF & _
"Quel est le prénom de votre partenaire ?" & @CRLF & _
"#GET_PRENOM_PARTENAIRE#" & @CRLF & _
"Bien, nous allons pouvoir commencer votre tirage tarot maintenant !" & @CRLF & _
"[ELSE]" & @CRLF & _
"oooo" & @CRLF & _
"[/IF]" & @CRLF & _
"[/IF]" & @CRLF & _
"" & @CRLF & _
"[IF #!CATEGORIE#]" & @CRLF & _
"[/IF]"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; 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