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 

Keep first 5 Characters, Add Text, and Keep Ext?

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



Joined: 23 May 2007
Posts: 9

PostPosted: Fri May 02, 2014 5:15 pm    Post subject: Keep first 5 Characters, Add Text, and Keep Ext? Reply with quote

Hi

I have files named like this: "08749 description of file contents.pdf"

My goal is to keep the five digit number, add the letters "fa" after the number, and keep the ".pdf" extension. So the above file would become "08749fa.pdf"

Ive figured out how to add the letters "fa", but cannot figure out how to delete the "description of file contents" portion of the file name.

Can someone give me some ideas on this? Thanks in advance for your time.

UPDATE:

I got this figured out - below is what I used in case this is useful to someone else. There are probably more elegant ways to accomplish this using PFrank, but this worked for me.

Row 1 Search Pattern:
(?x)(^.{1,5})(.*) # Insert the text: 'myText' after position 5

Row 1 Replace Pattern:
\1fa\2

Row 2 Search Pattern:
(?Ex)^(.{1,7}).*$ # keep 1st 7 chars in prefix

Row 2 Replace Pattern:
\1
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