Regular Expressions 101

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(.*)\.S(.{2})E(.*).720p.*(?=\.)
/
g

Description

This regex will rename your torrented files (usually associated with RSS feeds, as that is the style used with this expression) to something more human friendly. If using on a *nix os, I've noticed that you have to create all parent directories if using the "rename" script (I have not found any way around this bug).

When using *nix os, I found this simple script to be handy:

rename 's/(.*)\.S(.{2})E(.*).720p.*(?=\.)/\/DIR\/$1\/Season $2\/Episode.$3/gi' *

Enjoy

Submitted by "TJ" Johnson of www.anakin.ca - 8 years ago (Last modified a year ago)