#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?x){%\ (if)[\s\S]*?{%\ end\1\ %}|" & @CRLF & _
"{%.+?%}|" & @CRLF & _
"{{.+?}}"
Local $sString = "<div class="post-preview">" & @CRLF & _
" <div class="post-title">" & @CRLF & _
" <div class="post-name">" & @CRLF & _
" <a href="{{ post.url }}">{{ post.title }}</a>" & @CRLF & _
" </div>" & @CRLF & _
" <div class="post-date">" & @CRLF & _
" {% include time.html %}" & @CRLF & _
" </div>" & @CRLF & _
" </div>" & @CRLF & _
"" & @CRLF & _
" <div class="post-snippet">" & @CRLF & _
" {% if post.content contains '<!--break-->' %}" & @CRLF & _
" {{ post.content | split:'<!--break-->' | first }}" & @CRLF & _
" <div class="post-readmore">" & @CRLF & _
" <a href="{{ post.url }}">read more-></a>" & @CRLF & _
" </div>" & @CRLF & _
" {% endif %}" & @CRLF & _
" </div>" & @CRLF & _
" {% include post-meta.html %}" & @CRLF & _
"</div>"
Local $sSubst = ""
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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