File Renaming Help

A swapping-ground for Regular Expression syntax

File Renaming Help

Postby jpersson » Wed Jul 23, 2014 6:09 pm

Hello All-

...I am looking for help writing a regular expression that will swap groups in a filename. For instance, I have a file named "A ST #1-7.pdf" that needs to be named "#1-7 A ST.pdf" The filenames all start with an uppercase letter but the length of that field is variable. The field starting with the # to the (.) before pdf can be one number or a range of numbers...thanks in advance!
jpersson
 
Posts: 1
Joined: Wed Jul 23, 2014 6:03 pm

How to swap groups in a filename?

Postby Stefan » Sat Jul 26, 2014 8:24 pm

jpersson wrote:Hello All-

...I am looking for help writing a regular expression that will swap groups in a filename.
For instance, I have a file named "A ST #1-7.pdf" that needs to be named "#1-7 A ST.pdf"
The filenames all start with an uppercase letter but the length of that field is variable.
The field starting with the # to the (.) before pdf can be one number or a range of numbers...thanks in advance!


FROM:
"A ST #1-7.pdf"
TO:
"#1-7 A ST.pdf"


You will need to find an anchor, common to all your files, to create a rule to split the name to swap the parts around. Is this always the sign '#' ?

In the forum you will find many examples how to swap name parts and adapt the solution to your needs.

And please, next time enter a meaningful subject, to this thread can be of an help for more users too.
"File Renaming Help" is not very clever for a forum about file renaming.



Please wait a few seconds then submit. Thank you.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU


Return to Regular Expressions