#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "url\([\.]{2}\/(\w+(([\/]\w+)*(-\w+|\.\w+))*)"
Local $sString = "d: url(../images/printer.gif) top left no-repeat; {" & @CRLF & _
" .preview .mw-wiki-logo {" & @CRLF & _
" background-image: url(/static/images/project-logos/enwiki-1.5x.png); background-size: 135px auto background-image: url(/static/images/project-logos/enwiki-2x.png); " & @CRLF & _
".preview li.mw-changeslist-line-watched, .preview li.mw-history-line-updated {" & @CRLF & _
" list-style-image: url(//upload.wikimedia.org/wikipedia/commons/1/19/ChangedBulletVector.svg);" & @CRLF & _
" list-style-image: url(//upload.wikimedia.org/wikipedia/commons/c/c2/ChangedBulletVector.png) \9" & @CRLF & _
"}" & @CRLF & _
" }" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"@media (-webkit-min-device-pixel-ratio: 2),(min--moz-device-pixel-ratio: 2),(min-resolution: 2dppx),(min-resolution: 192dpi) {" & @CRLF & _
" .preview .mw-wiki-logo {" & @CRLF & _
" background-image: url(/static/images/project-logos/enwiki-2x.png);" & @CRLF & _
" background-size: 135px auto" & @CRLF & _
" }" & @CRLF & _
"}"
Local $sSubst = "url(//en.wikipedia.org/${1})"
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