How to use the replaceAll with exclusion

All about user-defined episode / movie / file name format expressions
Post Reply
FamousOneDay
Posts: 3
Joined: 23 Mar 2020, 09:32

How to use the replaceAll with exclusion

Post by FamousOneDay »

Hello. Been piecing together what i can from other people's expressions and trying to learn.
Is there a way to exclude things? So for example, I would like to have the video codec show in the file name only if its x265 and if so, change from x265 to HEVC, otherwise don't include at all.|
Been using bulk renamer to first remove the [ ] as I'm not sure how modify my expression to pick that up yet.
After filebot, use bulk renamer again to add the encoder's name at the end as sometimes it catches and sometimes it doesn't. not sure.

Original:
Rick and Morty S04E01 Edge of Tomorty Rick Die Rickpeat [1080p AI BD x265 10bit Joy]

After BRU:
Rick and Morty S04E01 Edge of Tomorty Rick Die Rickpeat 1080p x265 10bit Joy

After expression:
Rick and Morty (2013) - 4x01 - Edge of Tomorty Rick Die Rickpeat 1080p.BD.x265.10bit-

After BRU again:
Rick and Morty (2013) - 4x01 - Edge of Tomorty Rick Die Rickpeat 1080p.BD.HEVC.10bit-Joy

Code: Select all

{n.removeIllegalCharacters()} ({y}) - {sxe} - {t.removeIllegalCharacters()} {vf}{"."+fn.match(/(?i:AMZN)/).toUpperCase()}{"."+fn.match(/(?i:DSNP)/).toUpperCase()}{"."+fn.match(/(?i:HULU)/).toUpperCase()}{"."+source.replaceAll(/WEBRip/, "WEB-DL")}{"."+fn.match(/(?i:x265)/)}{"."+fn.match(/(?i:HEVC)/).toUpperCase()}{"."+fn.match(/(?i:10bit)/).toLowerCase()}{"."+fn.match(/(?i:DDP5.1)/).toUpperCase()}{"."+fn.match(/(?i:AAC5.1)/)}{"."+fn.match(/(?i:AAC7.1)/)}{"."+fn.match(/(?i:EAC3 5.1)/)}-{fn.match(/(?:(?<=[-])\w+$)|(?:^\w+(?=[-]))/)}
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to use the replaceAll with exclusion

Post by rednoah »

e.g. check vc and yield HEVC or nothing depending on the situation:

Code: Select all

vc =~ /x265/ ? 'HEVC' : null
:arrow: viewtopic.php?t=4191
:idea: Please read the FAQ and How to Request Help.
FamousOneDay
Posts: 3
Joined: 23 Mar 2020, 09:32

Re: How to use the replaceAll with exclusion

Post by FamousOneDay »

Thank you.
For some reason the code from the link didn't work but yours did.

didn't work

Code: Select all

{if (vc == x265) ' .HEVC'}

Code: Select all

{vc == x265 ? ' .HEVC' : null}
worked

Code: Select all

{vc =~ /x265/ ? '.HEVC' : null}
Post Reply