#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mi)^(?<title>(?![(\[]).+?)((\W|_))(\(?\b(?<edition>(((Recut.|Extended.|Ultimate.)?(Director.?s|Collector.?s|Theatrical|Ultimate|Extended|Despecialized|(Special|Rouge|Final|Assembly|Imperial|Diamond|Signature|Hunter|Rekall)(?=(.(Cut|Edition|Version)))|\d{2,3}(th)?.Anniversary)(?:.(Cut|Edition|Version))?(.(Extended|Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit))?|((Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit|Restored|((2|3|4)in1))))))\b\)?.{1,3})?(?:(?<!(19|20)\d{2}.*?|((The([-_. ]Good)?)|La|Aleksei)[-_. ])(German|French|TrueFrench))(?!.*?(German|French|TrueFrench|[-_. ].+?(19|20)\d{2}))[-_. ](?=((19|20)\d{2}|$|(DL|BluRay|WEB|WebHD|WebRip|720p|1080p|2160p|E?AC3D?|Subbed|DTS(-HD)?|COMPLETE|DVDR|HDTV|HDTVRip|PAL|DVD9|ML|MULTi|READNFO|UHD|BDRIP|DOKU|DD|SUBBED|DUBBED|DV|INTERNAL|iNT|BDRiP|HEVC|AVC|3D|DVD|S?VCD|DVDRiP|TS|LD|CAM|\(?\b(?<edition2>(((Recut.|Extended.|Ultimate.)?(Director.?s|Collector.?s|Theatrical|Ultimate|Extended|Despecialized|(Special|Rouge|Final|Assembly|Imperial|Diamond|Signature|Hunter|Rekall)(?=(.(Cut|Edition|Version)))|\d{2,3}(th)?.Anniversary)(?:.(Cut|Edition|Version))?(.(Extended|Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit))?|((Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit|Restored|((2|3|4)in1))))))\b\)?)))(?<year>(19|20)\d{2})?(.*?)(\W+|_|$)(?!\\)"
Local $sString = "//Tests From Github PR" & @CRLF & _
"211.2018.MULTi.TRUEFRENCH.1080p.BluRay.DTS-HDMA.x264-EXTREME" & @CRLF & _
"8mm.1999.CUSTOM.MULTi.TRUEFRENCH.1080p.BluRay.x264-YOP" & @CRLF & _
"8mm.1999.CUSTOM.MULTi.TRUEFRENCH.1080p.BluRay.x264-YOP" & @CRLF & _
"A.Coeur.Vaillant.Rien.D.Impossible.1991.TRUEFRENCH.1080p.HDTV.AC3.X264-QWERTZ" & @CRLF & _
"A.Quiet.Place.Part.11.2020.TRUEFRENCH.720p.BluRay.x264.AC3-EXTREME" & @CRLF & _
"A.Walk.ToRemember.2002.CUSTOM.MULTi.TRUEFRENCH.1080p.BluRay.x264-DELICIOUS" & @CRLF & _
"A.Walk.To.Remember.2002.CUSTOM.MULTi.TRUEFRENCH.1080p.BluRay.x264-DELICIOUS" & @CRLF & _
"About.Adam.2001.TRUEFRENCH.1080p.AMZN.WEB-DL.H264-BOLTON08" & @CRLF & _
"Acusada.2019.MULTi.TRUEFRENCH.1080p.WEB-DL.H264.AC3-STVFRV" & @CRLF & _
"Acusada2019.TRUEFRENCH.HDRiP.x264.AC3-STVFRV" & @CRLF & _
"Addams.Family.Values.1993.CUSTOM.MULTi.TRUEFRENCH.1080p.BluRay.REMUX.AVC.VFF.AC3.2.0.VO.DTS-HDMA.5.1-Goldenyann" & @CRLF & _
"After.We.Collided.2020.TRUEFRENCH.720p.BluRay.x264-UTT" & @CRLF & _
"After.We.Fell.2021.MULTi.TRUEFRENCH.1080p.BluRay.DTS.x264-UTT" & @CRLF & _
"After.We.Fell.2021.MULTi.TRUEFRENCH.1080p.BluRay.x264-UTT" & @CRLF & _
"After.We.Fell.2021.MULTi.TRUEFRENCH.1080p.HDLight.x264.AC3-EXTREME" & @CRLF & _
"After.We.Fell.2021.MULTi.TRUEFRENCH.1080p.WEB.H264-EXTREME" & @CRLF & _
"" & @CRLF & _
"Dune.Part.One.2021.TRUEFRENCH.BDRip.x264-Ulysse" & @CRLF & _
"Dune.Part.One.2021.TRUEFRENCH.720p.BluRay.x264-Ulysse" & @CRLF & _
"Dune.Part.One.2021.MULTI.TRUEFRENCH.1080p.BluRay.x264-Ulysse" & @CRLF & _
"Dune.Part.One.2021.MULTI.TRUEFRENCH.2160p.UHD.BluRay.x265-SESKAPILE" & @CRLF & _
"F9.The.Fast.Saga.2021.DC.TRUEFRENCH.BDRip.x264-Ulysse" & @CRLF & _
"F9.The.Fast.Saga.2021.DC.MULTi.TRUEFRENCH.1080p.BluRay.x264-Ulysse" & @CRLF & _
"F9.The.Fast.Saga.2021.DC.TRUEFRENCH.720p.BluRay.x264-Ulysse" & @CRLF & _
"Hitmans.Wifes.Bodyguard.2021.EXTENDED.TRUEFRENCH.720p.BluRay.x264-Ulysse" & @CRLF & _
"Hitmans.Wifes.Bodyguard.2021.EXTENDED.TRUEFRENCH.BDRip.x264-Ulysse," & @CRLF & _
"Hitmans.Wifes.Bodyguard.2021.EXTENDED.MULTI.TRUEFRENCH.1080p.BluRay.x264-Ulysse," & @CRLF & _
"Spirit.Untamed.2021.TRUEFRENCH.BDRip.x264-Ulysse" & @CRLF & _
"Spirit.Untamed.2021.TRUEFRENCH.720p.BluRay.x264-Ulysse" & @CRLF & _
"Spirit.Untamed.2021.MULTI.TRUEFRENCH.1080p.BluRay.x264-Ulysse" & @CRLF & _
"Space.Jam.A.New.Legacy.2021.MULTI.TRUEFRENCH.2160p.UHD.BluRay.x265-SESKAPILE" & @CRLF & _
"Space.Jam.A.New.Legacy2021.TRUEFRENCH.BDRip.x264-Ulysse" & @CRLF & _
"Space.Jam.A.New.Legacy.2021.MULTi.TRUEFRENCH.1080p.BluRay.x264-Ulysse" & @CRLF & _
"Space.Jam.A.New.Legacy.2021.TRUEFRENCH.720p.BluRay.x264-Ulysse" & @CRLF & _
"" & @CRLF & _
"//Match without YEAR but with edition" & @CRLF & _
"Der.Movie.Eine.Unerwartete.Reise.Extended.German.720p.BluRay.x264-EXQUiSiTE" & @CRLF & _
"Die.Unfassbaren.Movie.Name.EXTENDED.German.DTS.720p.BluRay.x264-RHD" & @CRLF & _
"Die Unfassbaren Movie Name EXTENDED German DTS 720p BluRay x264-RHD" & @CRLF & _
"Das.A.Team.Der.Film.Extended.Cut.German.720p.BluRay.x264-ANCIENT" & @CRLF & _
"" & @CRLF & _
"//Match without YEAR" & @CRLF & _
"Movie.Weg.des.Kriegers.German.720p.BluRay.x264-EXQUiSiTE" & @CRLF & _
"Movie.Weg.des.Kriegers.German.Extended.720p.BluRay.x264-EXQUiSiTE //Match when followed by edition" & @CRLF & _
"Passengers.German.DL.AC3.Dubbed..BluRay.x264-PsO" & @CRLF & _
"Cars.2.German.DL.720p.BluRay.x264-EmpireHD" & @CRLF & _
"The.German.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"Cars.2.german.CAM.720p.BluRay.x264-EmpireHD" & @CRLF & _
"Appaloosa.TRUEFRENCH.DVDRiP.XViD-UNSKiLLED" & @CRLF & _
"Arthur.Weihnachtsmann.German.DL.1080p.BluRay.x264-SONS" & @CRLF & _
"Arthur.Weihnachtsmann.German.AC3.BDRiP.XViD-SONS" & @CRLF & _
"The.German.Cam.German.720p.HDTV.x264-TVP" & @CRLF & _
"" & @CRLF & _
"//Match with YEAR" & @CRLF & _
"The.Good.German.German.2006.DVDRiP.SVCD-ATS" & @CRLF & _
"Herman.the.German.GERMAN.2019.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"Der.Film.deines.Lebens.German.2011.PAL.DVDR-ETM" & @CRLF & _
"Joe.Bell.German.2020.AC3.BDRiP.x264-ROCKEFELLER" & @CRLF & _
"The.CaM.MAN.German.2006.720p.HDTV.x264-TVP" & @CRLF & _
"The.German.Cam.German.2006.720p.HDTV.x264-TVP" & @CRLF & _
"The.Good.German.German.2006.DVDRiP.SVCD-ATS //TODO It should match the year here" & @CRLF & _
"Deadlock.German.2021.AC3.BDRiP.x264-ROCKEFELLER" & @CRLF & _
"" & @CRLF & _
"//TEST TRUEFRENCH" & @CRLF & _
"10x10.2018.MULTi.TRUEFRENCH.1080p.BluRay.x264-LOST" & @CRLF & _
"10x10.2018.TRUEFRENCH.720p.BluRay.x264-LOST" & @CRLF & _
"10x10.2018.TRUEFRENCH.BDRip.x264-PRiDEHD" & @CRLF & _
"12.Rounds.2009.MULTi.WiTH.TRUEFRENCH.1080p.BluRay.x264-MUxHD" & @CRLF & _
"12.Rounds.2009.TRUEFRENCH.720p.BluRay.x264-MUxHD" & @CRLF & _
"12.Rounds.TRUEFRENCH.DVDRip.XviD-REVOLTE" & @CRLF & _
"12.Years.a.Slave.2013.MULTi.TRUEFRENCH.1080p.BluRay.x264-FiDELiO" & @CRLF & _
"12.Years.a.Slave.2013.TRUEFRENCH.720p.BluRay.x264-FiDELiO" & @CRLF & _
"12.Years.a.Slave.2013.TRUEFRENCH.BDRip.x264-LOFiDEL" & @CRLF & _
"127.Hours.MULTi.WiTH.TRUEFRENCH.1080p.BluRay.x264.DTS-LOST" & @CRLF & _
"127.Hours.TRUEFRENCH.720p.BluRay.x264.DTS-LOST" & @CRLF & _
"127.Hours.TRUEFRENCH.BDRip.XviD-AYMO" & @CRLF & _
"A.Christmas.Carol.TRUEFRENCH.DVDRip.XviD-REVOLTE" & @CRLF & _
"Angels.And.Demons.EXTENDED.TRUEFRENCH.720p.BluRay.x264.DTS-UKDHD" & @CRLF & _
"Appaloosa.TRUEFRENCH.DVDRiP.XViD-UNSKiLLED" & @CRLF & _
"Arthur.Et.La.Vengeance.De.Maltazard.DVDRiP.TRUEFRENCH.XViD-FUCK" & @CRLF & _
"Astro.Boy.TRUEFRENCH.DVDRip.XviD-AYMO" & @CRLF & _
"Australia.TRUEFRENCH.DVDRip.XviD-UNSKiLLED" & @CRLF & _
"Black.Swan.DiRFiX.TRUEFRENCH.720p.BluRay.x264.DTS-LOST" & @CRLF & _
"" & @CRLF & _
"//SHOULD NOT MATCH" & @CRLF & _
"Its.a.German.Bluray.2013.AC3.DVDRiP.x264-ETM //This should not match when scene word is followed after a year" & @CRLF & _
"Its.a.German.Cam.girl.2013.AC3.DVDRiP.x264-ETM //This should not match when scene word is followed after a year" & @CRLF & _
"The.German.Cam.2012.720p.HDTV.x264-TVP" & @CRLF & _
"The.German.2012.720p.HDTV.x264-TVP" & @CRLF & _
"German.Song.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"" & @CRLF & _
"German.Lancers.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"German.Lancers.2019.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"German.Lancers.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"" & @CRLF & _
"German.Lessons.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"German.Fighters.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"German.Fried.Movie.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"My.German.Boyfriend.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"German.Grusel.-.Die.Edgar.Wallace-Serie.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"German.Jets.and.Destroyers.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"Tülay.German:.Kor.ve.Ateş.Yılları.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"" & @CRLF & _
"The.German.Doctor.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"" & @CRLF & _
"Movie.Squad.2016.EXTENDED.German.DL.AC3.BDRip.x264-hqc //Should not match" & @CRLF & _
"Movie.and.Movie.2010.Extended.Cut.German.DTS.DL.720p.BluRay.x264-HDS //Should not match" & @CRLF & _
"Gaia.Gruene.Hoelle.2021.German.DL.1080p.BluRay.AVC-UNTAVC //Should not match" & @CRLF & _
"Gaia.Gruene.Hoelle.German.2021.German.DL.1080p.BluRay.AVC-UNTAVC //Should not match" & @CRLF & _
"Movie.Klasse.von.1999.1990.German.720p.HDTV.x264-NORETAiL" & @CRLF & _
"" & @CRLF & _
"La.French.2014.PL.iNT.DVDRiP.x264-N0L" & @CRLF & _
"La.French.2014.FRENCH.DVDRip.x264-PHoQUE" & @CRLF & _
"La.French.2014.PAL.FRENCH.DVDR-Ryotox" & @CRLF & _
"The.Good.German.2006.GERMAN.720p.HDTV.x264-TVP" & @CRLF & _
"Wakolda.German.Subbed.2013.AC3.DVDRiP.x264-ETM //TODO This is bullshit with subbed, don't bother" & @CRLF & _
"The.German.Doctor.2013.LIMITED.DVDRip.x264-RedBlade" & @CRLF & _
"The.Good.German.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"The.Good.German.2019.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"Herman.the.German.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"Herman.the.German.2019.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"Aleksei.German.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"Aleksei.German.2019.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"The.German.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"The.German.2019.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
"Der.Movie.Eine.Unerwartete.Reise.Extended.2020.German.720p.BluRay.x264-EXQUiSiTE //should not parse" & @CRLF & _
"The.Good.German.-.In.den.Ruinen.von.Berlin.2019.GERMAN.720p.BluRay.x264-UNiVERSUM" & @CRLF & _
""
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
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