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 

How to delete all characters from a bracket on

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



Joined: 07 Jul 2009
Posts: 3

PostPosted: Tue Jul 07, 2009 2:07 am    Post subject: How to delete all characters from a bracket on Reply with quote

I have some files I copied from my web browser that are named 'filename[1]200905090513145.jpg' etc. Also have some that just have 'filename[1].*'. I would like to delete everything from the first bracket on. I found a similar post from someone to delete everything after a '-' and tried to modify it with a [, but I get an error saying that it's an unexpected end of syntax or something like that.

Please help!

Thanks

wolfman6
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 446
Location: Canada

PostPosted: Tue Jul 07, 2009 4:18 pm    Post subject: Reply with quote

Hi,

Just put '\[.*' in the search column of the first row (don't inlcude the single quotes). leave the replace column of that row empty.
That will delete everything from the first bracket onwards.
Note that since brackets are special characters in regualr expressions you needed to escape them by preceeding them with a backslash.

Hope that helps.

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



Joined: 07 Jul 2009
Posts: 3

PostPosted: Wed Jul 08, 2009 2:50 am    Post subject: How to delete all characters from a bracket on Reply with quote

Hi,

Thanks for replying. It looks like it will work, but it will delete the file extension, too and I don't want to do that - only the prefix.

How do I modify to leave the extension alone?

Thank you!!
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 446
Location: Canada

PostPosted: Wed Jul 08, 2009 1:33 pm    Post subject: Reply with quote

Try '(?E)\[.*'
- again don't include the single quotes.

The preceeding '(?E)' will make the regex engine skip the extension.

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



Joined: 07 Jul 2009
Posts: 3

PostPosted: Wed Jul 08, 2009 1:37 pm    Post subject: Reply with quote

Works great! Thank you so much for your help!
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