Swapping Fields in a Filename

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Swapping Fields in a Filename

Postby rjemery » Thu Mar 27, 2008 6:44 pm

I am using BRU 2.7.0.1 on a XP Pro SP2 system. I have a situation where I have existing files named in this format: AAAMMYYBBB.pdf
where AAA and BBB are variable length strings, MM refers to a two digit code for MONTH, and YY refers to a two digit code for YEAR. I wish to swap MONTH and YEAR. How could I do that?
rjemery
 
Posts: 17
Joined: Sat Sep 15, 2007 6:51 am

Re: Swapping Fields in a Filename

Postby Stefan » Thu Mar 27, 2008 7:40 pm

rjemery wrote:I am using BRU 2.7.0.1 on a XP Pro SP2 system. I have a situation where I have existing files named in this format: AAAMMYYBBB.pdf
where AAA and BBB are variable length strings, MM refers to a two digit code for MONTH, and YY refers to a two digit code for YEAR. I wish to swap MONTH and YEAR. How could I do that?

Use RegEx

AAAMMYYBBB
AAA1207BBB

Code: Select all
AAA are variable length strings,          ==>   .+    ==> find any kind of char, one or more. "Group"  by using ( )   ==> Group 1 =  (.+)
MM refers to a two digit code for MONTH,  ==>   \d\d  ==> find two digits. "Group" the search expression by using ( ) ==>  Group 2 = (\d\d)
YY refers to a two digit code for YEAR.   ==>   \d\d  ==> find two digits. "Group" the search expression by using ( ) ==>  Group 3 = (\d\d)
BBB are variable length strings,          ==>   .+    ==> find any kind of char, one or more. "Group" by using ( )    ==>  Group 4 =  (.+)

So RegEx search for (.+)(\d\d)(\d\d)(.+)
Replace with Group 1 , Group 3, Group 2, Group 4     => \1\3\2\4   .............Or  was it $1$3$2$4 syntax  in BRU?


Edit by Admin: it's \1\3\2\4. Thanks Stefan!
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Swapping Fields in a Filename

Postby rjemery » Sat Mar 29, 2008 6:05 am

Thank you both. The regular expressions worked very well.
rjemery
 
Posts: 17
Joined: Sat Sep 15, 2007 6:51 am


Return to BRU Support