Skip to content
This repository was archived by the owner on Mar 21, 2023. It is now read-only.

RegularExpressions

Andrew Jackson edited this page Aug 23, 2012 · 2 revisions

Regular Expressions

TV Sorter uses regular expressions to identify the season and episode number of a show. There are several built in that handle almost all naming conventions for TV show episodes however, it may be the case that a file name is in an unknown format.

This is intended as a brief description on how regular expressions work for TV Sorter and not a tutorial on regular expressions in general.

The regular expressions used must contain named groups S and E for season and episode, or Y, M and D for year, month and day. These all need to be numeric except for Month which can also be written. Double episode support is provided by allowing the group E to be matched multiple times. For example: s(?<S>[0-9]+)e((?<E>[0-9]+)-{0,1})+

The regular expression matches the format S01E01-02. The expression starts with an S, then contains the S group for a number, then an E and a group containing the E group and an optional -.

TV Sorter assumes that everything before the match is the show name, therefore any data included the filename before the season and episode number, but not part of the show name, should be matched by the regular expression.

If a match does not contain at least 1 match on an S and E group, or on Y, M and D groups. The expression is considered invalid and will not be used.

Clone this wiki locally