#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)\n{3,}"
Local $sString = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, " & @CRLF & _
"sed do eiusmod tempor incididunt ut labore et dolore magna " & @CRLF & _
"Tincidunt nunc pulvinar sapien et ligula ullamcorper " & @CRLF & _
"malesuada proin libero. Sit amet risus nullam eget." & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"Purus gravida quis blandit turpis cursus in hac. Felis " & @CRLF & _
"bibendum ut tristique et egestas. Curabitur vitae nunc sed " & @CRLF & _
"vitae nunc sed velit. Nunc faucibus a pellentesque sit amet " & @CRLF & _
"porttitor eget dolor."
Local $sSubst = "\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