Regular Expressions 101

Community Patterns

matching filenames to episodes and/or season

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(.+?)[-. ]{0,3}(S(\d?\d)[E](\d\d)|(S(\d?\d)))[-. ]{0,3}
/
gm

Description

i was having a difficult time matching delimited episode names AND season names.

since episodes follow:

show.name.Sxx.Exx.resolution.source

and seasons:

show.name.year.Sxx.reso.source

and sometimes show names end in S followed by year when its a duplicate named show after the original. i'd get bad matches with movie names. hopefully this can help someone with a similar issue

Submitted by Gallo S. Chingon - a year ago