MC includes three regexs which cover the three most common naming conventions.
For season one, episode two
These three will work for the vast majority of content because they are case insensitive, and will recognize up to four digit numbers for each set, the season and the episode number; or in the third case, an infinite number of seasons with up to 99 episodes
If there is some odd-ball convention used in the naming of some of your media, it may be possible to avoid having to edit the names of all the files by creating a custom Regex.
Because it works as is more often than not, and because adding more may lead to further complications, we will not give you additional regexs here, but we will give you the tools you need to create your own.
Before getting started, and getting frustrated, be sure to read all the way through this page for a better understanding of how MC uses the Regexs.
has a nice selection of additional regexs. The ones listed there are extremely specific, but one of them be just what you need. Even if none of them is exactly what you are looking for, it is useful to see the differences between the regexs compared
to what they do.
Microsoft Developer Network
both offer reference sheets with explanations and examples to help understand what you are looking at when reading a regex and help with ideas for what can be done
When you are ready to start building your own it may be useful to test them on
A neat site where you can input your regex and some text to test it against, it can give you an explanation of the regex, and also tell
, which are what MC will read as the season and episode numbers.
Implementation of Regex in MC
MC employs a regex in such a way that whatever matches against the first set of parenthesis () in the regex returns the season number, and the second set returns the episode number.
- There is an interesting
discussion where coordinator StormyKnight points out a way to have the regex return the
last match instead of the first by repeating the entire regex inside a set of parenthesis but preceding it with ?!.*
- Also, coordinator HueyHQ has a tip that allows additional sets of parenthesis to be used in a regex by adding ?: to the beginning so that it is matched but not returned.
this would look for the A or a before returning the B or b and the C or c.
You've tested a new regex and now want to implement it in MC
If you've finished testing a regex in the regex section and are now ready to put it to use, but it may be a good idea to give it a "real life" test of ID'ing the show you are working with before allowing it to be tested against everything in the main
- To be extra cautious when testing out a new regex, you can temporarily remove all the shows from MC except the one you are trying to work with, or extract a second copy of MC into a separate folder from the main one that can be used just for testing purposes.
Either way, this will protect any media you aren't working directly with from becoming an innocent bystander when testing out a regex.
Changing Regex Order
The order of the regexs can be rearranged in MC. This is important to note because they are run through in order from top to bottom when MC is trying to get the season and episode numbers, so you will probably want to leave any regex you add to MC at the bottom,
especially if it's something you are unsure of. This way it is less likely that MC make changes to media that has already been properly identified.
On the other hand, one regex may id the majority of shows correctly but misidentify one show; while a regex below it on the list would identify that one show correctly but could misidentify other shows incorrectly.
This should not be an issue unless you are using custom regexes, but an example would be:
\Shows\Sealab 2021\Season 1\02.avi
You could make a regex that gets the season number from the folder name since the regexes are tested against the entire file path; we'll call that one the S1\02 regex. In this particular case, the S1\02 regex would clash with the 102 regex that comes with MC.
Using the same example of \Shows\Sealab 2021\Season1\...
* Leaving the 102 regex ahead of the S1\02 regex would cause all the episodes of the show to be identified as Season 20 Episode 21 since it uses the first match it gets to.
* Switching the order of the 102 and S1\02 regexs would solve the problem for that specific show, but could mess up other shows by identifying the season number from the folder name and identifying the season number from the file name as the episode number.
To properly address this problem, the S1\02 regex can be temporarily moved up in the order list, and that specific show can be searched for new episodes. Now that the shows episodes have been id'd correctly the regex order can be changed back to prevent problems
with other shows.
Note that restarting, closing and re-opening, MC is required every time the regex order is changed.
Share to empower yourself and other users
If you create a regex that you find particularly useful, feel free to post it in the comments section below along with an explanation and example.
<MC Documentation Home