#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?mx)^(?P<artist>.+?(?=\s-\s)) # artist with pos. lookahead" & @CRLF & _
"\s-\s # space - space" & @CRLF & _
"(?P<title>.+?(?=(?:\(?Feat\.)|$)) # title with pos. lookahead " & @CRLF & _
"\(? # optional open parenthesis" & @CRLF & _
" (?P<artist2>Feat\.[^()\n]+)? # artist2 with Feat. before" & @CRLF & _
"\)? # optional closing parenthesis" & @CRLF & _
"(?P<subtitle>.+)?$ # optional subtitle"
Local $sString = "Black Coast - Trndsttr" & @CRLF & _
"Black Coast - Trndsttr (Feather)" & @CRLF & _
"Black Coast - Trndsttr (Lucian Remix)" & @CRLF & _
"Black Coast - Trndsttr (Feather) (Lucian Remix)" & @CRLF & _
"Black Coast - Trndsttr Feat. M. Maggie" & @CRLF & _
"Black Coast - Trndsttr (Feat. M. Maggie)" & @CRLF & _
"Black Coast - Trndsttr Feat. M. Maggie (Lucian Remix)" & @CRLF & _
"Black Coast - Trndsttr (Feat. M. Maggie) (Lucian Remix)" & @CRLF & _
"Black Coast - Trndsttr (Lucian Remix) Feat. M. Maggie" & @CRLF & _
"Black Coast - Trndsttr (Lucian Remix) (Feat. M. Maggie)" & @CRLF & _
"Black Coast - Trndsttr (Feather) (Lucian Remix) Feat. M. Maggie" & @CRLF & _
"Black Coast - Trndsttr (Feather) (Lucian Remix) (Feat. M. Maggie)" & @CRLF & _
"Black Coast - Trndsttr (Feather) Feat. M. Maggie (Lucian Remix)" & @CRLF & _
"Black Coast - Trndsttr (Feather) (Feat. M. Maggie) (Lucian Remix)" & @CRLF & _
"Black Coast - Trndsttr (Feather) (Feat. M. Maggie) Lucian Remix" & @CRLF & _
"Black Coast - Trndsttr (Feather) Feat. M. Maggie Lucian Remix" & @CRLF & _
""
Local $sSubst = "$1 $3 - $2$4"
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