#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?mix)^\s*(\+[0-9][0-9]\s*|0|)(7.*)"
Local $sString = "+41 79 123 456 78" & @CRLF & _
"+417612345678" & @CRLF & _
"076 123 456 78" & @CRLF & _
"07812345678" & @CRLF & _
"7712345678" & @CRLF & _
"" & @CRLF & _
"+41 47 123 456 78" & @CRLF & _
"+413212345678" & @CRLF & _
"021 123 456 78" & @CRLF & _
"02212345678" & @CRLF & _
"3412345678"
Local $sSubst = "$2"
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