#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?mx)[[:blank:]]*+(?:[\[\(].*[\]\)][[:blank:]]*+)?(.*?)[[:blank:]\[\(]*+([1-2]\d{3}).*" & @CRLF & _
""
Local $sString = "2 Fast 2 Furious [2003] [SD]" & @CRLF & _
"2 Fast 2 Furious (2003) [SD]" & @CRLF & _
"2 Fast 2 Furious ((2003) [SD]" & @CRLF & _
"A Goofy Movie (1995) (HD) (720p)" & @CRLF & _
"[test]A Goofy Movie (1995) (HD) (720p)" & @CRLF & _
"(test) A Goofy Movie (1995) (HD) (720p)" & @CRLF & _
"2 Fast 2 Furious 2003 " & @CRLF & _
" 2 Fast 2 Furious 2003" & @CRLF & _
"The Lion King 2- Simba's Pride (1998) (HD) (1080p)" & @CRLF & _
"The.Grand.Budapest.Hotel.2014.1080p.BluRay.x264-BLOW" & @CRLF & _
"Another.Earth.2011.LIMITED.720p.BluRay.X264-AMIABLE" & @CRLF & _
"The.Green.Mile.1999.720p.BluRay.x264-HDCLASSiCS" & @CRLF & _
"The Road 2009 Bluray DTS 720 p - TRiNiTY" & @CRLF & _
"Dead Poets Society (1989) 720p Blu-ray x264 DTS MSubs [DDR]" & @CRLF & _
"Garden.State.2004.720p.BluRay.X264-AMIABLE" & @CRLF & _
""
Local $sSubst = "\1 (\2) \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