Peters Flexible RenAmiNg Kit (PFrank) Forum Index Peters Flexible RenAmiNg Kit (PFrank)
Support and Discussion Site for the PFrank File/Folder Renaming Tool (http://www3.telus.net/pfrank)
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Moving file extension to the end of file name.

 
Post new topic   Reply to topic    Peters Flexible RenAmiNg Kit (PFrank) Forum Index -> Regular Expressions
View previous topic :: View next topic  
Author Message
harterlynn



Joined: 29 Jun 2008
Posts: 3

PostPosted: Sun Jun 29, 2008 3:33 pm    Post subject: Moving file extension to the end of file name. Reply with quote

I am new to regular expressions and I am using PKFRANK to rename a long list of files. Could anyone help me out with the syntex for the regular expression to do the following.

How to move file extension to the end of file name using a regular expression.

Using Search Pattern: REGEX.

This is an example of a file name I want to rename:

AP JOURNAL.RTF - APRIL 07
TO
AP JOURNAL - APRIL 07.RTF

Also, how to define an "OR" statement in a search pattern?

APRIL OR APR
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 446
Location: Canada

PostPosted: Mon Jun 30, 2008 12:45 pm    Post subject: Reply with quote

Try the following (when pasting to the search/replace column, do not paste the single quotes as they are for highlighting only):

Row: 1
Search: '(.*?)([.].*?)([ ].*)'
Replace: '\1\3\2'

This will isolate the extension in the second group and move it to the end.

After using the above do you still need to use the OR pattern? If you do then let me know with some example before/after names.

Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
harterlynn



Joined: 29 Jun 2008
Posts: 3

PostPosted: Mon Jun 30, 2008 3:43 pm    Post subject: REPLY Reply with quote

Thank you Peter for the reply.

I will try this solution when I get home tonight.

Conserning the OR statement.


Search for this: (This is where I need the OR Statement.)
APRIL, April, APR, Apr

Replace with:
04-08

Thank you for all the help.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 446
Location: Canada

PostPosted: Mon Jun 30, 2008 4:18 pm    Post subject: Reply with quote

The '|' character is used to set up an OR expression.
To change variations of 'April' to '04-08' add the following to the second row (again don't include the single quotes):

Row: 2
Search: 'APRIL|April|APR|Apr'
Replace: '04-08'

Hope this helps!

Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
harterlynn



Joined: 29 Jun 2008
Posts: 3

PostPosted: Mon Jun 30, 2008 5:56 pm    Post subject: Reply with quote

Thank you for the help.

Your answers where great.

I hope to learn a great deal more about Regular Expressions in the near future.

Thanx's again.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Peters Flexible RenAmiNg Kit (PFrank) Forum Index -> Regular Expressions All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own Video Sharing Site

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com