#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?ms)^(?!\t)(?:(FULL|SMALL)\W*)?([^\n]+)(.+?)(?=^(?!\t)\w+?|$(?!\n))"
Local $sString = "" & @CRLF & _
"" & @CRLF & _
"Gahriel and Diana are standing in the living room. " & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"FULL: The living room has SOFA and a table. On the table have CUPCAKE and a NOTE at the bottom (or somewhere that doesn’t present the first time we see it.) Gahriel is walking to the kitchen calling out his mom." & @CRLF & _
" Gahriel" & @CRLF & _
" Make yourself at home!" & @CRLF & _
" Diana " & @CRLF & _
" okay!" & @CRLF & _
" Gahriel" & @CRLF & _
" (calling out his mom)" & @CRLF & _
" Mom?" & @CRLF & _
" Where is she?" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"SMALL- Diana inside the living room with Gabriel. She’s amazed with the picture on the wall related to his mother and young Gahriel. " & @CRLF & _
"" & @CRLF & _
" Diana ask" & @CRLF & _
" Is this you and your mom?" & @CRLF & _
"" & @CRLF & _
" Gahriel (smiling)" & @CRLF & _
" Haha, yup." & @CRLF & _
" That’s me." & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"Diana (yelling and laughing so loud and keep talking)" & @CRLF & _
" Diana" & @CRLF & _
" Argh.. that’s so cute." & @CRLF & _
" Look at how chubby you are!" & @CRLF & _
""
Local $sSubst = "<div class="PANEL $1">\n<div class="action">$2</div></div>\n\n"
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