#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?<newfield>AB\d{2}-)"
Local $sString = "1 1401812.AQWEAB02-TCPL02.1G" & @CRLF & _
"2 1356292.QWERAB04-ANCA02" & @CRLF & _
"3 1234OAB05-PLAIN02 reserved ||" & @CRLF & _
"4 1405252.AB07-SBCC01" & @CRLF & _
"5 1409325-ARDRAB05-GENIV02.22" & @CRLF & _
"6 1304030.ARDRAB07-TECEL02.10333" & @CRLF & _
"7 1389621.ABFDBC01-COGDS02333" & @CRLF & _
"8 1349222.ABFDBC01-MOH29.5MJJ" & @CRLF & _
"9 1313513.ABFDBC01-BPRSS" & @CRLF & _
"10 1393599.ABFDBC01-WGELP" & @CRLF & _
"11 1375957.ABFDBC01-BREQL01.0M222" & @CRLF & _
"12 1332348.ABFDBC01-MANNG01.10M1WW1" & @CRLF & _
"13 1321017.ABFDBC01-BLJCW01.3MQQ"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
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