Extract Season and Episode from Filename


#1

Hi folks, great application, really powerful... I am afraid I must draw on your expertise however, I have an action group that takes mp4 filenames and extracts TVSHOW, ARTIST, TITLE etc. I want to extract the season and episode number too. It is a well known format

The Vampire Diaries S01E16 Hdtv Xvid-Notv.mp4

(.)\sS\d+e\d+\s(.)

$1 is the programme name
$2 I use as the title (sometimes it's the title sometimes its not as above).

what variable can I use to get at the S01E01 values? I am not certain what or how $regexp determines the returned parameter values? Any help greatly appreciated.

Glawster


#2

Just add more sets of parentheses:

(.)\s(S\d+)(E\d+)\s(.)

They're numbered from left to right, so with the above regex you now have:

$1 is the program name
$2 is the season
$3 is the episode
$4 is the title


#3

Brilliant, works like a charm. Thanks.