#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^(?<artist>[\w ]+)\/(?<album>[\w ]+)\/(( - )|(\d+)|\k<artist>|\k<album>|[_])*(?<name>.+)(?<ext>\.(flac|mp3))$"
Local $sString = "Infected Mushroom/" & @CRLF & _
"Infected Mushroom/Vicious Delicious" & @CRLF & _
"Infected Mushroom/Vicious Delicious/01 - Infected Mushroom - Becoming Insane.flac" & @CRLF & _
"Infected Mushroom/Vicious Delicious/02 - Infected Mushroom - Artillery.flac" & @CRLF & _
"Infected Mushroom/Vicious Delicious/03 - Infected Mushroom - Vicious Delicious.flac" & @CRLF & _
"Infected Mushroom/Vicious Delicious/04 - Infected Mushroom - Heavyweight.flac" & @CRLF & _
"Infected Mushroom/Vicious Delicious/05 - Infected Mushroom - Suliman.flac" & @CRLF & _
"Infected Mushroom/Vicious Delicious/06 - Infected Mushroom - Forgive Me.flac" & @CRLF & _
"Infected Mushroom/Vicious Delicious/07 - Infected Mushroom - Special Place.flac" & @CRLF & _
"Infected Mushroom/Vicious Delicious/08 - Infected Mushroom - In Front Of Me.flac" & @CRLF & _
"Infected Mushroom/Vicious Delicious/09 - Infected Mushroom - Eat It Raw.flach Mushroom - Before.flac" & @CRLF & _
"Infected Mushroom/Army of Mushrooms" & @CRLF & _
"Infected Mushroom/Army of Mushrooms/01 - Never Mind.flac" & @CRLF & _
"Infected Mushroom/Army of Mushrooms/02 - Nothing to Say.flac" & @CRLF & _
"Infected Mushroom/Army of Mushrooms/03 - Send Me an Angel.flac" & @CRLF & _
"Infected Mushroom/Army of Mushrooms/04 - U R So Fucked.flac" & @CRLF & _
"Infected Mushroom/Army of Mushrooms/05 - The Rat.flac" & @CRLF & _
"Infected Mushroom/Army of Mushrooms/06 - Nation of Wusses.flac" & @CRLF & _
"Infected Mushroom/Army of Mushrooms/07 - Wanted To.flac" & @CRLF & _
"Infected Mushroom/Army of Mushrooms/08 - Serve My Thirst.flac" & @CRLF & _
"Infected Mushroom/Army of Mushrooms/09 - I Shine.flac" & @CRLF & _
"Infected Mushroom/Army of Mushrooms/10 - Drum n' Bassa.flac" & @CRLF & _
"Infected Mushroom/Army of Mushrooms/11 - The Pretender.flac" & @CRLF & _
"Infected Mushroom/Army of Mushrooms/12 - The Messenger 2012.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/01 - She Zoremet.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/02 - Yamakas in Space.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/03 - Sense of Direction.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/04 - Animatronica.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/05 - Feelings.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/06 - Pink Froid.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/07 - Demons of Pain.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/08 - Zoan Zound.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/09 - Blue Swan 5.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/10 - Fields of Grey (feat. Sasha Grey).flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/11 - Leopold.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/12 - On the Road Again.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/13 - Stuck in a Loop.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/14 - Mexicali.flac" & @CRLF & _
"Infected Mushroom/Converting Vegetarians II/15 - The Surgeon.flac" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma/Infected Mushroom - Legend of the Black Shawarma - 01 - Poquito Mas.flac" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma/Infected Mushroom - Legend of the Black Shawarma - 02 - Sa'eed.flac" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma/Infected Mushroom - Legend of the Black Shawarma - 03 - End of the Road.flac" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma/Infected Mushroom - Legend of the Black Shawarma - 04 - Smashing the Opponent (feat. Jonathan Davis).flac" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma/Infected Mushroom - Legend of the Black Shawarma - 05 - Can't Stop.flac" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma/Infected Mushroom - Legend of the Black Shawarma - 06 - Herbert the Pervert.flac" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma/Infected Mushroom - Legend of the Black Shawarma - 07 - Killing Time (feat. Perry Ferrell).flac" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma/Infected Mushroom - Legend of the Black Shawarma - 08 - Project 100.flac" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma/Infected Mushroom - Legend of the Black Shawarma - 09 - Franks.flac" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma/Infected Mushroom - Legend of the Black Shawarma - 10 - Slowly.flac" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma/Infected Mushroom - Legend of the Black Shawarma - 11 - The Legend of the Black Shawarma.flac" & @CRLF & _
"Infected Mushroom/Legend of the Black Shawarma/Infected Mushroom - Legend of the Black Shawarma - 12 - Riders on the Storm (Infected Mushroom Remix).flac" & @CRLF & _
"Infected Mushroom/Pink Nightmares" & @CRLF & _
"Infected Mushroom/Pink Nightmares/01_Pink_Nightmares_Album_Mix.flac" & @CRLF & _
""
Local $sSubst = "\g<name>\g<ext>"
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