Catch regex match issue
This commit is contained in:
parent
4a7287c7d9
commit
3c885a0c21
@ -4,32 +4,32 @@ const acceptedPatternMappings = [
|
||||
{
|
||||
name: 'Full match',
|
||||
pattern: /([Ss][0-9]+[Ee][0-9]+)/,
|
||||
mapper: (matches) => `${matches[0]}`,
|
||||
mapper: (matches) => `${matches[1]}`,
|
||||
},
|
||||
{
|
||||
name: 'Space separated single number',
|
||||
pattern: / ([0-9][0-9]+) /,
|
||||
mapper: (matches) => `S01E${matches[0]}`,
|
||||
mapper: (matches) => `S01E${matches[1]}`,
|
||||
},
|
||||
{
|
||||
name: 'End of filename number, leading space',
|
||||
pattern: / ([0-9][0-9]+)\./,
|
||||
mapper: (matches) => `S01E${matches[0]}`,
|
||||
mapper: (matches) => `S01E${matches[1]}`,
|
||||
},
|
||||
{
|
||||
name: 'Underscore separated number',
|
||||
pattern: /_([0-9][0-9]+)_/,
|
||||
mapper: (matches) => `S01E${matches[0]}`,
|
||||
mapper: (matches) => `S01E${matches[1]}`,
|
||||
},
|
||||
{
|
||||
name: 'End of filename number, leading underscore',
|
||||
pattern: /_([0-9][0-9]+)\./,
|
||||
mapper: (matches) => `S01E${matches[0]}`,
|
||||
mapper: (matches) => `S01E${matches[1]}`,
|
||||
},
|
||||
{
|
||||
name: 'Any number >= 2 characters',
|
||||
pattern: /([0-9][0-9]+)/,
|
||||
mapper: (matches) => `S01E${matches[0]}`,
|
||||
mapper: (matches) => `S01E${matches[1]}`,
|
||||
},
|
||||
];
|
||||
|
||||
@ -43,7 +43,7 @@ export async function extractToEpisodeNumber(inputDir, inputFile, outputDir, opt
|
||||
|
||||
const extensionMatches = inputFile.match(extensionPattern);
|
||||
|
||||
const extension = extensionMatches ? extensionMatches[0] : '';
|
||||
const extension = extensionMatches ? extensionMatches[1] : '';
|
||||
|
||||
const toWrite = `${outputDir}${outputFileName}${extension}`;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user