#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^(.*)(?:\n\1.*)+"
Local $sString = "canon" & @CRLF & _
"cmap" & @CRLF & _
"cmapx" & @CRLF & _
"cmapx_np" & @CRLF & _
"dot" & @CRLF & _
"dot_json" & @CRLF & _
"eps" & @CRLF & _
"fig" & @CRLF & _
"gd" & @CRLF & _
"gd2" & @CRLF & _
"gif" & @CRLF & _
"gv" & @CRLF & _
"imap" & @CRLF & _
"imap_np" & @CRLF & _
"ismap" & @CRLF & _
"jpe" & @CRLF & _
"jpeg" & @CRLF & _
"jpg" & @CRLF & _
"json" & @CRLF & _
"json0" & @CRLF & _
"mp" & @CRLF & _
"pdf" & @CRLF & _
"pic" & @CRLF & _
"plain" & @CRLF & _
"plain-ext" & @CRLF & _
"png" & @CRLF & _
"pov" & @CRLF & _
"ps" & @CRLF & _
"ps2" & @CRLF & _
"svg" & @CRLF & _
"svgz" & @CRLF & _
"tk" & @CRLF & _
"vdx" & @CRLF & _
"vml" & @CRLF & _
"vmlz" & @CRLF & _
"vrml" & @CRLF & _
"wbmp" & @CRLF & _
"webp" & @CRLF & _
"x11" & @CRLF & _
"xdot" & @CRLF & _
"xdot1.2" & @CRLF & _
"xdot1.4" & @CRLF & _
"xdot_json" & @CRLF & _
"xlib"
Local $sSubst = "$1"
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