#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?<![\w\-]="|")(https?:\/\/[\w\-\.!~?&=+\*'(),\/\#\:]+)((?!\<\/\w\>))*?"
Local $sString = "<a href="https://worldofwarships.ru/">https://worldofwarships.ru/</a><div><br></div>" & @CRLF & _
"" & @CRLF & _
"<div data-test="https://worldofwarships.ru/1">https://worldofwarships.ru/1</div>" & @CRLF & _
"" & @CRLF & _
"<div>https://worldofwarships.ru/0</div>" & @CRLF & _
"" & @CRLF & _
"<div>https://worldofwarships.ru/0</div>" & @CRLF & _
"" & @CRLF & _
"<div> https://worldofwarships.ru/2</div>" & @CRLF & _
"" & @CRLF & _
"https://worldofwarships.ru/3?test=https://worldofwarships.ru/" & @CRLF & _
"" & @CRLF & _
"https://worldofwarships.ru/4#https://worldofwarships.ru/" & @CRLF & _
"" & @CRLF & _
"https://worldofwarships.ru/5" & @CRLF & _
"" & @CRLF & _
"<div>https://worldofwarships.ru/3<br clear="all">" & @CRLF & _
"<div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Тестовый аккаунт</div></div>" & @CRLF & _
"</div>" & @CRLF & _
"" & @CRLF & _
"<img src="https://worldofwarships.ru/3?test=https://worldofwarships.ru/3"/>" & @CRLF & _
"<img src="https://worldofwarships.ru/3#https://worldofwarships.ru/3"/>" & @CRLF & _
"" & @CRLF & _
"<form action="https://worldofwarships.ru/3"></form>"
Local $sSubst = "<a href="$1">$1</a>"
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