#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?x){@ (?<cond>\w+) - (?<stat>\w+(?:%\w+)*) (?: : (?<sub>\w+))? \|" & @CRLF & _
"" & @CRLF & _
"# a "THEN" part that doesn't have a nested conditional statement" & @CRLF & _
"(?<then>[^{|@]*+ (?: {(?!@) [^{|@]* | @(?!}) [^{|@]* )*+ )" & @CRLF & _
"" & @CRLF & _
"# optional "ELSE" part (the content is similar to the "THEN" part)" & @CRLF & _
"(?: \| (?<else> \g<then> ) )? (*SKIP) @}"
Local $sString = "{@if-is_not_logged_homepage|" & @CRLF & _
"<header id="header_home">" & @CRLF & _
" <div class="in">" & @CRLF & _
" <div class="top">" & @CRLF & _
" <h1 class="logo"><a href="/"><img src="/img/logo-home.png" alt=""></a></h1>" & @CRLF & _
" <div class="login_outer_wrapper">" & @CRLF & _
" <button id="login"><div class="a"><i class="stripe"><i></i></i>Log in</div></button>" & @CRLF & _
" <div id="login_wrapper">" & @CRLF & _
" <form method="post" action="{^login^}" id="form_login_global">" & @CRLF & _
" <div class="form_field no_description">" & @CRLF & _
" <label>{!auth:login_email!}</label>" & @CRLF & _
" <div class="input"><input type="text" name="form[login]"></div>" & @CRLF & _
" </div>" & @CRLF & _
" <div class="form_field no_description password">" & @CRLF & _
" <label>{!auth:password!}</label>" & @CRLF & _
" <div class="input"><input type="password" name="form[password]"></div>" & @CRLF & _
" </div>" & @CRLF & _
" <div class="remember">" & @CRLF & _
" <input type="checkbox" name="remember" id="remember_me_check" checked>" & @CRLF & _
" <label for="remember_me_check"><i class="fa fa-check" aria-hidden="true"></i>Remember</label>" & @CRLF & _
" </div>" & @CRLF & _
" <div class="submit_box">" & @CRLF & _
" <button class="btn btn_check">Log in</button>" & @CRLF & _
" </div>" & @CRLF & _
" </form>" & @CRLF & _
" </div>" & @CRLF & _
" </div>" & @CRLF & _
" </div>" & @CRLF & _
" <div class="content clr">" & @CRLF & _
" <div class="main_menu">" & @CRLF & _
" <a href="">" & @CRLF & _
" <i class="ico a"><i class="fa fa-lightbulb-o" aria-hidden="true"></i></i>" & @CRLF & _
" <span>Idea</span>" & @CRLF & _
" <div> </div>" & @CRLF & _
" </a>" & @CRLF & _
" <a href="">" & @CRLF & _
" <i class="ico b"><i class="fa fa-user" aria-hidden="true"></i></i>" & @CRLF & _
" <span>FFa</span>" & @CRLF & _
" </a>" & @CRLF & _
" <a href="">" & @CRLF & _
" <i class="ico c"><i class="fa fa-briefcase" aria-hidden="true"></i></i>" & @CRLF & _
" <span>Buss</span>" & @CRLF & _
" </a>" & @CRLF & _
" </div>" & @CRLF & _
" <div class="text_wrapper">" & @CRLF & _
"" & @CRLF & _
" <div>" & @CRLF & _
" <div class="register_wrapper">" & @CRLF & _
" <a id="main_register" class="btn register">Załóż konto</a>" & @CRLF & _
" <form method="post" action="{^login^}" id="form_register_home">" & @CRLF & _
" <div class="form_field no_description">" & @CRLF & _
" <label>{!auth:email!}</label>" & @CRLF & _
" <div class="input"><input type="text" name="form2[email]"></div>" & @CRLF & _
" </div>" & @CRLF & _
" <div class="form_field no_description password">" & @CRLF & _
" <label>{!auth:password!}</label>" & @CRLF & _
" <div class="input tooltip"><input type="password" name="form2[password]"><i class="fa fa-info-circle tooltip_open" aria-hidden="true" title="{!auth:password_format!}"></i></div>" & @CRLF & _
"" & @CRLF & _
" </div>" & @CRLF & _
" <div class="form_field terms no_description">" & @CRLF & _
" <div class="input">" & @CRLF & _
" <input type="checkbox" name="form2[terms]" id="terms_check">" & @CRLF & _
" <label for="terms_check"><i class="fa fa-check" aria-hidden="true"></i>Agree</label>" & @CRLF & _
" </div>" & @CRLF & _
" </div>" & @CRLF & _
" <div class="form_field no_description">" & @CRLF & _
" <div class="input captcha_wrapper">" & @CRLF & _
" <div class="g-recaptcha" data-sitekey="{%captcha_public_key%}"></div>" & @CRLF & _
" </div>" & @CRLF & _
" </div>" & @CRLF & _
" <div class="submit_box">" & @CRLF & _
" <button class="btn btn_check">{!auth:register_btn!}</button>" & @CRLF & _
" </div>" & @CRLF & _
" </form>" & @CRLF & _
" </div>" & @CRLF & _
" </div>" & @CRLF & _
" </div>" & @CRLF & _
" </div>" & @CRLF & _
" </div>" & @CRLF & _
"</header>" & @CRLF & _
"| babubibo" & @CRLF & _
"@}"
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