Quick question about leading "The"

All about user-defined episode / movie / file name format expressions
Post Reply
Franky
Posts: 9
Joined: 31 Mar 2021, 16:38

Quick question about leading "The"

Post by Franky »

When I have a title with both "The" at the start AND a sub-title, for example "The Mummyː Tomb of the Dragon Emperor (2008)", it currently moved the "The" to the end of the complete title, like this "Mummyː Tomb of the Dragon Emperor, The (2008)"
I'd prefer to put the moved "The" to before the subtitle, like so: "Mummy, Theː Tomb of the Dragon Emperor (2008)". Is there an easy way to do that?

Here's my expression:

Code: Select all

{n.replace(
    '<' : '﹤',
    '>' : '﹥',
    ':' : 'ː',
    '"' : '“',
    '/' : '⁄',
    '|' : '⼁',
    '?' : '﹖',
    '*' : '﹡',
    '\\': '∖'
).replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/)} {'('+y+')'}
{' - '+vf.removeAll(/p/)}
{self.video[0].scantype ? self.video[0].scantype[0].lower() : 'p'}
{' '+self.video[0].formatcommercial.match(/MPEG-[1,2]/) ? self.video[0].formatcommercial.removeAll(/ Video/) : null}
{' '+video[0].formatString.removeAll(/ Visual|MPEG Video/)}
{if (hdr=="Dolby Vision" && video[0].HDRformatprofile =~ "05")" DV5" else ""}
{if (hdr=="Dolby Vision" && video[0].HDRformatprofile =~ "06")" DV6" else ""}
{if (hdr=="Dolby Vision" && video[0].HDRformatprofile =~ "07")" DV7" else ""}
{if (hdr=="Dolby Vision" && video[0].HDRformatprofile =~ "08")" DV" else ""}
{self.video[0].transfer_characteristics.match(/HLG/) ? ' HLG' : null}
{self.hdr ? ' '+self.video[0].HDR_Format_Compatibility.match(/HDR10\+|HDR10/) : self.bitdepth == 10 ? ' 10bit' : null}
{fps.value > 31 ? ' '+fps.value.round()+'fps' : null}
{', ' + aco.replaceAll('Layer 3','MP3').replaceAll('Layer 2','MP2').replaceAll('Dolby Digital','AC3').replaceAll(' Plus','+').replaceAll('Master Audio','MA').replaceAll('Atmos',' Atmos').removeAll(/Dolby | with | Discrete| Matrix| High Resolution Audio| \+ DTS/).replace(
    '<' : '﹤',
    '>' : '﹥',
    ':' : 'ː',
    '"' : '“',
    '/' : '⁄',
    '|' : '⼁',
    '?' : '﹖',
    '*' : '﹡',
    '\\': '∖'
) }
{' '+channels}
{' ('+audio.first().LanguageString2+')'}
{' ['+vs+']'}
{fn.match(/_new/) ? '[C]' : null}
{fn.match(/\[C\]/)}
{ any{ ' '+fn.match(/\{edition-.*\}/) }{ " {edition-${tags[0]}}".removeAll(/\]|\[/) } }
{fn.match(/ - pt\d/)}
{ fn.match(/disc\d/)}
{subt}
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Quick question about leading "The"

Post by rednoah »

e.g.

Format: Select all

{ 'The X: Y'.replaceFirst(/^(?i)(The|A|An)\s(.+?)(?=:|$)/, /$2, $1/) }

Code: Select all

X, The: Y
:idea: Please read the FAQ and How to Request Help.
Franky
Posts: 9
Joined: 31 Mar 2021, 16:38

Re: Quick question about leading "The"

Post by Franky »

Cool, thanks!
Post Reply