#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^(drv:\d+)(?:[\s\S]+?(?:Name|Serial|Port):.*$){3}\n\h*(\[[^\]]+?])"
Local $sString = "HDClone 6 Enterprise Edition" & @CRLF & _
"Serial: 1111111111" & @CRLF & _
"" & @CRLF & _
"Miray Software AG" & @CRLF & _
"Gaissacher Str. 18" & @CRLF & _
"81371 Munich" & @CRLF & _
"Germany" & @CRLF & _
"" & @CRLF & _
"Detecting drives." & @CRLF & _
"drv:0 Name: WDC WD40EZRZ-00WN9B0 (4,000,754 MB)" & @CRLF & _
" Serial: WD-WCC4E0ESU7YK" & @CRLF & _
" Port: 0/1/1/0" & @CRLF & _
" [ -, M:, X: ]" & @CRLF & _
"To specify this drive, use the following parameters:" & @CRLF & _
"-srcdrv:/-dstdrv:0" & @CRLF & _
"-srcdrvn:/-dstdrvn:"WDC WD40EZRZ-00WN9B0"" & @CRLF & _
"-srcdrvn:/-dstdrvn:"WDC WD40EZRZ-00WN9B0WD-WCC4E0ESU7YK"" & @CRLF & _
"-srvdrvp:/-dstdrvp:0/1/1/0" & @CRLF & _
"" & @CRLF & _
"drv:1 Name: ST2000DM001-1CH164 (2,000,399 MB)" & @CRLF & _
" Serial: S1E1GA0V" & @CRLF & _
" Port: 0/1/1/1" & @CRLF & _
" [ S:, T: ]" & @CRLF & _
"To specify this drive, use the following parameters:" & @CRLF & _
"-srcdrv:/-dstdrv:1" & @CRLF & _
"-srcdrvn:/-dstdrvn:ST2000DM001-1CH164" & @CRLF & _
"-srcdrvn:/-dstdrvn:ST2000DM001-1CH164S1E1GA0V" & @CRLF & _
"-srvdrvp:/-dstdrvp:0/1/1/1" & @CRLF & _
"" & @CRLF & _
"drv:2 Name: ST2000DM001-1CH164 (2,000,399 MB)" & @CRLF & _
" Serial: S1E1GC0Z" & @CRLF & _
" Port: 0/0/0/1" & @CRLF & _
" [ B:, P: ]" & @CRLF & _
"To specify this drive, use the following parameters:" & @CRLF & _
"-srcdrv:/-dstdrv:2" & @CRLF & _
"-srcdrvn:/-dstdrvn:ST2000DM001-1CH164" & @CRLF & _
"-srcdrvn:/-dstdrvn:ST2000DM001-1CH164S1E1GC0Z" & @CRLF & _
"-srvdrvp:/-dstdrvp:0/0/0/1" & @CRLF & _
"" & @CRLF & _
"drv:3 Name: WDC WD10EADS-11M2B2 (1,000,205 MB)" & @CRLF & _
" Serial: WD-WCAV5D430071" & @CRLF & _
" Port: 0/0/2/0" & @CRLF & _
" [ -, V: ]" & @CRLF & _
"To specify this drive, use the following parameters:" & @CRLF & _
"-srcdrv:/-dstdrv:3" & @CRLF & _
"-srcdrvn:/-dstdrvn:"WDC WD10EADS-11M2B2"" & @CRLF & _
"-srcdrvn:/-dstdrvn:"WDC WD10EADS-11M2B2WD-WCAV5D430071"" & @CRLF & _
"-srvdrvp:/-dstdrvp:0/0/2/0" & @CRLF & _
"" & @CRLF & _
"drv:4 Name: KINGSTON SMS200S360G (60,023 MB)" & @CRLF & _
" Serial: 50026B72440A6EE7" & @CRLF & _
" Port: 0/1/3/0" & @CRLF & _
" [ C: ]" & @CRLF & _
"To specify this drive, use the following parameters:" & @CRLF & _
"-srcdrv:/-dstdrv:4" & @CRLF & _
"-srcdrvn:/-dstdrvn:"KINGSTON SMS200S360G"" & @CRLF & _
"-srcdrvn:/-dstdrvn:"KINGSTON SMS200S360G50026B72440A6EE7"" & @CRLF & _
"-srvdrvp:/-dstdrvp:0/1/3/0"
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