Help switching date format

A swapping-ground for Regular Expression syntax

Help switching date format

Postby Pete Whiteside » Fri Jul 13, 2018 5:23 pm

Hi,

New to the forum and been playing around with BRU for a few days.

I am having doing a specific task and hope someone can help me with the expressions

My example :

I have a lot of movie clips that have date in the format DD.MM.YY and wish to switch this to YY.MM.DD

clips have different names, prefix etc and I want the BRU to search for anything and switch the date around but the date may not be in a specific character number..

in other words

[thailand] 01.12.18 - Clip01.mpg
[australia] Clip 01 01.06.17.mpg

will become

[thailand] 18.12.01 - Clip01.mpg
[australia] Clip 01 17.06.01.mpg

Is there a way I can do this ?

xx.yy.zz

swap xx and zz (but only when it finds xx.yy.zz)

Thanks, hopefully this makes sense ??
Pete Whiteside
 
Posts: 1
Joined: Fri Jul 13, 2018 5:13 pm

Re: Help switching date format

Postby therube » Fri Jul 13, 2018 8:18 pm

In its source form, only you can know if xx .. zz is actually xx .. zz or is already zz .. xx.
So it will take some manual examination by you.

just going to ramble rather then come up with a solution...

sometime ago, using a different program, & having files in the form: LATESmmyy
& wanting them to be the form: LATESyymm
after reviewing my files to knock out ambiguous names (where mm could be yy or vice-versa)
i was able to use this:

(LATES)([0-9][0-9])([0-9][0-9])
$(1)$(3)$(2)

again using a different program...

regex:[01-12]{2}\.[01-31]{2}\.[00-18]{2}

to find your date parts
but you'd have to be able to break that up into the pieces of the date into mm dd yy
so that you can rearrange things
perhaps that can be done here, with RegEx, but if so, that's beyond me

& if that can be done, then it's a matter of collecting the other parts of the name & getting it all in order

easy right ;-)


Suspect it might be easier to do something like that using JavaScript?


OK, so with that (& more rambling)...

1:RegEx
Code: Select all
Match:  (.*) ([01-12]{2})\.([01-31]{2})\.([00-18]{2}) (.*)
Replace:  \1 \4.\3.\2 \5


Hmm... is that going to do it?
(And you could change the YY replacing 00 with something that might be more appropriate for you...)

(no time to check at present...)
therube
 
Posts: 1317
Joined: Mon Jan 18, 2016 6:23 pm


Return to Regular Expressions