#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?im)((?:bs )?(?:en )?(?:np )?is[o0]\s+[-\d]+:)(.+:)?(\d{4}(?:\(e\))?)"
Local $sString = "ISO 11784:1996/Amd.2:2010(E)" & @CRLF & _
"ISO 11784:2010(E)" & @CRLF & _
"ISO 11784:2010" & @CRLF & _
"ISO 11784-2-3-4:1996/Amd.2:2010(E)" & @CRLF & _
"ISO 11784-2-8-7:2010(E)" & @CRLF & _
"ISO 11784-5-120-78949-56-789:2010" & @CRLF & _
"BS EN ISO 11784:1996/Amd.2:2010(E)" & @CRLF & _
"EN ISO 11784:2010(E)" & @CRLF & _
"IS0 11784:2010" & @CRLF & _
"EN NP IS0 11784-2-3-4:1996/Amd.2:2010(E)" & @CRLF & _
"BS IS0 11784-2-8-7:2010(E)" & @CRLF & _
"EN NP ISO 11784-5-120-78949-56-789:2010" & @CRLF & _
""
Local $sSubst = "$1$3"
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