#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "interface GigabitEthernet1\/(1[2-9]|[1-2][0-1]).*\n(.*\n)*.* description \*\* Unused Port \*\*.*\n(.*\n)*.* switchport access vlan 1002.*\n(.*\n)*.* switchport mode access.*\n(.*\n)*.* switchport port-security.*\n(.*\n)*.* switchport port-security mac-address sticky.*\n(.*\n)*.* shutdown.*\n(.*\n)*.* no cdp enable.*\n(.*\n)*.* spanning-tree portfast" & @CRLF & _
""
Local $sString = "interface GigabitEthernet1/12" & @CRLF & _
" description ** Unused Port **" & @CRLF & _
" switchport access vlan 1002" & @CRLF & _
" switchport mode access" & @CRLF & _
" switchport port-security" & @CRLF & _
" switchport port-security mac-address sticky" & @CRLF & _
" shutdown" & @CRLF & _
" no cdp enable" & @CRLF & _
" spanning-tree portfast" & @CRLF & _
"!" & @CRLF & _
"interface GigabitEthernet1/13" & @CRLF & _
" description ** Unused Port **" & @CRLF & _
" switchport access vlan 1002" & @CRLF & _
" switchport mode access" & @CRLF & _
" switchport port-security" & @CRLF & _
" switchport port-security mac-address sticky" & @CRLF & _
" shutdown" & @CRLF & _
" no cdp enable" & @CRLF & _
" spanning-tree portfast" & @CRLF & _
"!" & @CRLF & _
""
Local $sSubst = ""
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