#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?i)(?:^|\ |\n)(((?:(?:http(?:s)?\:)?(?:\/\/))|(?:\/\/))?(?:(?=[a-z0-9\-\.]{1,255}(?=\/|\ |$|\:|\n|\?|\,|\!))(?:(?:(?:[a-z0-9]{1}(?:[a-z0-9\-]{1,62})?\.){1,127})[a-z]{2,}(?:\.[a-z]{2})?))(?:[a-z0-9\/\-\_\%\?\&\!\$\'\,\(\)\*\.\+\=\;])*?)(?=$|\.(?=\ |$)|\:|\n|\ |\?(?=\ |$)|\,|\!)"
Local $sString = "I really like to go to google.com and google stuff." & @CRLF & _
" <br>" & @CRLF & _
" I also like http://hercdev.io, both are pretty cool!" & @CRLF & _
"http://google.com" & @CRLF & _
" <br>" & @CRLF & _
" This is the url to an image: https://objects.dreamhost.com/herc-scripts/chicken_sombrero.gif" & @CRLF & _
" <br>" & @CRLF & _
" But this is the actual image: <img src="https://objects.dreamhost.com/herc-scripts/chicken_sombrero.gif" style="max-width: 100px;" />" & @CRLF & _
" <br>" & @CRLF & _
" Note that the url to the image in the <img> tag is unaffected. This is true for things that are already links also, like <a href="http://google.com" target="_blank">this.</a>"
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