Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2017-05-07 01:11
Updated·2023-07-27 15:28
Flavor·PCRE (Legacy)

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

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