fork download
  1. <?php
  2.  
  3. $string = "The.Real.Housewives.of.Salt.Lake.City.S01E16.1080p.x265.MeGusta";
  4. $string .= "\r\nMr.Mayor.S01E09.Palmtreereform.1080p.HEVC.x265-MeGusta[eztv.re]";
  5. $string .= "\r\nBattleBots.2015.S05E12.Were.Beast.Slayin.Tonight.1080p.x265.MeGusta";
  6. $string .= "\r\nGrowing.Up.Hip.Hop.Atlanta.S04E08.Call.Security.720p.x265.MeGusta";
  7.  
  8. $pattern = '/(^.*?S[0-9]{1,2}E[0-9]{1,2}\.?)(.*?)((?:1080p|720p|480p).*?)$/m';
  9. $replacement = '$1$3';
  10. $result = preg_replace($pattern, $replacement, $string);
  11. echo $result;
  12.  
  13.  
Success #stdin #stdout 0.02s 24336KB
stdin
Standard input is empty
stdout
The.Real.Housewives.of.Salt.Lake.City.S01E16.1080p.x265.MeGusta
Mr.Mayor.S01E09.1080p.HEVC.x265-MeGusta[eztv.re]
BattleBots.2015.S05E12.1080p.x265.MeGusta
Growing.Up.Hip.Hop.Atlanta.S04E08.720p.x265.MeGusta