$re = '/((?<=\b\d{4}\b)|\b(German|DE)\b.*)/im';
$str = 'Dirty.Work.Wie.deweit.wuerdest.Du.gehen.2018.German.AC3.WEBRip
Zwei.baerenstarke.Typen.1983.DE.EN.DTSHD.MasteDEr.5.1.2160p.HDR10.x265-kellerratte
The.Hills.Have.Eyes.1977.COMPLETE.UHD.BLURAY-UNTOUCHED
Wonder.Woman.1984.2020.GERMAN.DUBBED.DL.2160p.HDR.WEB.x265
Wonder.Woman.1984.GERMAN.2020.DUBBED.DL.2160p.HDR.WEB.x265
2012.German.2006.DL.2160p.UHD.BluRay.HDR.HEVC.Remux
Sherlock.Holmes.2009.German.DL.2022.ock.Holmes.UHD.BluRay.2160p.UHD.BluRay.HDR.HEVC.Remux
Der.Herr.Der.Ringe.Die.Gefaehrten.2001.Theatrical.German.DTSHD.DL.2160p.UHD.BluRay.HDR.x265-NIMA4K
ES.2017.German.Spezials.Bluray.1080p.AC3.x264
LX.2048.2020.German.DL.HDR.2160p.WEB.h265-W4K
Jason.Bourne.Collection.German.DUBBED.DTS.DL.2160p.BluRay.HEVC.Remux
Dirty.Work.Wie.weit.wuerdest.Du.gehen.2018.German.AC3.WEBRip.x264
LX.2048.2020.German.DL.HDR.2160p.WEB.h265
Moonlight.German.2016.720p.DTS.BluRay.x264-ENCOUNTERS
Wasabi.Ein.Bulle.in.Japan.2001.German.DTSHD.720p.BluRay.x264-DETAiLS
Operation.Overlord.2018.German.DL.AC3.Dubbed.720p.WEB.x264-PsO
2012.2018.German.DTSHDMaster.BluRay.x264-ENCOUNTERS
Wonder.Woman.1984.GERMAN.2020.DUBBED.DL.2160p.HDR.WEB.x265-TSCC
The.Matrix.Revolutions.2003.German.EAC3D.DL.2160p.UHD.BluRay.HDR.Dolby.Vision.HEVC.Remux-NIMA4K
Rogue.One.A.Star.Wars.Story.2016.German.UHDBD.2160p.HDR10.HEVC.EAC3.DL.Remux-pmHD
Jumanji.The.Next.Level.2019.German.Dubbed.DTSHD.DL.2160p.UHD.BluRay.HDR.HEVC.Remux-NIMA4K
Hannibal.2001.German.UHDBD.2160p.HDR10.HEVC.DTSHD.DUBBED.DL.Remux-pmHD
Mortal.Kombat.Legends.Scorpions.Revenge.2020.German.AC3D.DL.2160p.UHD.BluRay.HDR.HEVC.Remux-NIMA4K
Ruf.der.Wildnis.2020.German.EAC3.DL.2160p.UHD.BluRay.HDR.HEVC.Remux-NIMA4K
Sonic.The.Hedgehog.2020.German.AC3.DL.2160p.UHD.BluRay.HDR.HEVC.Remux-NIMA4K
Bad.Boys.for.Life.2020.German.DTSHD.DL.2160p.UHD.BluRay.HDR.HEVC.Remux-NIMA4K
Die.fantastische.Reise.des.Dr.Dolittle.2020.German.Dubbed.TrueHD.Atmos.DL.2160p.UHD.BluRay.HDR10Plus.HEVC.Remux-NIMA4K
Bloodshot.2020.German.UHDBD.2160p.HDR10.HEVC.DTSHD.DL.Remux-pmHD
Bloodshot.2020.German.DTSHD.DL.2160p.UHD.BluRay.HDR.HEVC.Remux-NIMA4K
The.Dark.Knight.Rises.2012.German.UHDBD.2160p.HDR10.HEVC.DTSHD.DL.Remux-pmHD
Jason.Bourne.Collection.German.DUBBED.DTS.DL.2160p.BluRay.HEVC.Remux-pmHD
2001.A.Space.Odyssey.1968.German.DL.AC3.2160p.Bluray.x265-Bi0hazard
LX.2048.2020.German.DL.HDR.2160p.WEB.h265-W4K
Onward.Keine.halben.Sachen.2020.German.EAC3D.DL.2160p.UHD.BluRay.HDR.HEVC.Remux.Repack-NIMA4K
Crying.Freeman.Der.Sohn.des.Drachen.1995.German.UHDBD.2160p.HDR10.HEVC.DTSHD.DL.Remux-pmHD
Kin.2018.German.Dubbed.DTSHD.DL.2160p.UHD.BluRay.HDR.HEVC.Remux-NIMA4K
The.Gentlemen.2019.German.DTSHD.DL.2160p.UHD.BluRay.HDR.HEVC.Remux-NIMA4K
VFW.2019.German.UHDBD.2160p.HDR10.HEVC.DTSHD.DL.Remux-pmHD
Trolls.2.Trolls.World.Tour.2020.German.TrueHD.Atmos.DL.2160p.UHD.BluRay.HDR10Plus.HEVC.Remux-NIMA4K
Sherlock.Holmes.Spiel.Im.Schatten.2011.German.DL.2160p.UHD.BluRay.HDR.HEVC.Remux-NIMA4K
Sherlock.Holmes.2009.German.DL.2160p.UHD.BluRay.HDR.HEVC.Remux-NIMA4K
Kevin.allein.zu.Haus.1990.German.DTSD.DL.2160p.UHD.BluRay.HDR.HEVC.Remux-NIMA4K
Full.Metal.Jacket.1987.German.UHDBD.2160p.HDR10.HEVC.AC3.DL.Remux-pmHD
A.Star.Is.Born.2018.German.UHDBD.2160p.DV.HDR10.HEVC.AC3.DL.Remux-pmHD
300.2006.German.DL.2160p.UHD.BluRay.HDR.HEVC.Remux-NIMA4K
Requiem.For.A.Dream.2000.German.US.UHDBD.2160p.DV.HDR10.HEVC.DTSHD.DL.Remux-pmHD
((?<=[0-9]{4})*|German.*|[0-9]{3,4}(p|i).*)
(German|(?<=\\b\\d{4}\\b).*$)
((\\b(DTS|Atmos|True|DD|MA)(-|\\W|)(HD|D|STER|)(|)(5|7|)1||)\\b)
\\b(DTS|Atmos|True|DD|HD|MA)(-|\\W|)(MA(STER|)|(D|HD|5|)|)|(MA|1|)((5|7|)1|)\\b
((?<=\\b\\d{4}\\b).*|German[^\\d{4}]*)';
$subst = "";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$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 PHP, please visit: http://php.net/manual/en/ref.pcre.php