I am no good with Regex, can someone help please?

A swapping-ground for Regular Expression syntax

I am no good with Regex, can someone help please?

Postby pir8radio » Thu Sep 15, 2016 2:26 am

I have this file/folder name:
Title-Second.Title.2016.Bluray.1080p.TrueHD-7.1.Atmos-Word
Everything after the year will be different for different files, so i need to strip all after year.

I would like to end up as:
Title - Second Title (2016)

can anyone help? I need to strip everything after the year, put the date in () replace the . with spaces and put a space on each side of the -

lol... I know i can use the replace function in BRU to remove the . and add the space, but the rest I'm clueless on...
pir8radio
 
Posts: 1
Joined: Thu Sep 15, 2016 2:21 am

Re: I am no good with Regex, can someone help please?

Postby KenP » Thu Sep 15, 2016 11:48 am

Someone may have a better solution but in the mean time try this.

RegEx (1)
Match: (.*)-(.*)(\d{4})
Replace: \1 - \2(\3)

Use the Replace (3) to change the . to space.
KenP
 
Posts: 196
Joined: Sat Jul 30, 2016 11:25 am


Return to Regular Expressions