#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?ms)^(PANEL\s+\S+)(.*?)(?=PANEL|\Z)"
Local $sString = "PANEL NORMAL" & @CRLF & _
"Diana and Gahriel run away with all their might. The monster is raging right behind them" & @CRLF & _
"" & @CRLF & _
" Gharial (whisper)" & @CRLF & _
" Don’t turn back!" & @CRLF & _
"" & @CRLF & _
" Diana (confused)" & @CRLF & _
" What--" & @CRLF & _
" " & @CRLF & _
"PANEL LEFT" & @CRLF & _
"" & @CRLF & _
"Gahriel signal diane to be quiet" & @CRLF & _
"" & @CRLF & _
" Gharial (put his hand to his mouth signal quiet)" & @CRLF & _
" Shh…." & @CRLF & _
"" & @CRLF & _
"PANEL FOCUS" & @CRLF & _
"" & @CRLF & _
"The monster is running toward them quickly , right behind them" & @CRLF & _
"" & @CRLF & _
"PANEL FULL" & @CRLF & _
"" & @CRLF & _
"Diana is afraid for her own life. Her eyes wide open as the monster breathes through her." & @CRLF & _
"" & @CRLF & _
" Diana (holding her mouth with her hand)" & @CRLF & _
" Gasp" & @CRLF & _
"" & @CRLF & _
"PANEL RIGHT" & @CRLF & _
" Gahriel (whisper)" & @CRLF & _
" Everything will be okay!" & @CRLF & _
"" & @CRLF & _
"PANEL CENTER" & @CRLF & _
"They both stand quietly, not a single noise.," & @CRLF & _
"" & @CRLF & _
"PANEL SMALL" & @CRLF & _
"A sudden noise" & @CRLF & _
"Crack" & @CRLF & _
"" & @CRLF & _
"PANEL RIGHT" & @CRLF & _
"The monster caught Diana and bit her head off. Gahriel in shock-terror, he can’t move." & @CRLF & _
"" & @CRLF & _
""
Local $sSubst = "<div class="$1">$2</div>"
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