Peters Flexible RenAmiNg Kit (PFrank) Forum Index Peters Flexible RenAmiNg Kit (PFrank)
Support and Discussion Site for the PFrank File/Folder Renaming Tool (***NEW HOME PAGE*** "http://pfrank.atwebpages.com")
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

lower case between ( ) brackets?

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



Joined: 19 Apr 2008
Posts: 6

PostPosted: Sat Apr 19, 2008 5:24 pm    Post subject: lower case between ( ) brackets? Reply with quote

This is my first post, so let me say hi!

I am trying to figure out what would be the right course of actions in PFrank to make all characters that appear between the ( ) brackets lower case?

Any help would be greatly appreciated!
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sat Apr 19, 2008 6:15 pm    Post subject: Reply with quote

If the bracketed text appears in different positions then you would need a plugin (see http://www3.telus.net/pfrank/PFrankUserCommand.html). Otherwise you could use the predefined command called "lower case in" and specify the positions you would like changed to lower case.

Let me know if you need a plugin.

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



Joined: 19 Apr 2008
Posts: 6

PostPosted: Sat Apr 19, 2008 6:28 pm    Post subject: Reply with quote

Typically the kind of info that I would like to leave lower case between the () appears at the beginning of files. Info that appears between () in the middle of files can stay uppercase.

I had tried the predefined "lower case in" command but I'm not sure what kind of info to put in the = box. I was trying what I thought was some regular expression stuff like (*) but to be honest I'm not very good with that and all I managed to generate were errors Smile

Let's assume for now that the bracketed text always appears at the beginning of a file name.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sat Apr 19, 2008 6:53 pm    Post subject: Reply with quote

Actually using the predefined command for lower case would only work if the text inside the brackets was the same length. But I've thought of a nifty way to do it using the following mix of regex and predefined commands:

Row: 1
Search: '^(.*[\[\(\{])(.+?)([\}\)\}])(.*)$'
Replace: '\1\3\4.\2'
Row: 2
Search:
Replace: '*Lower Case in*Extension*'
Row: 3
Search: '^(.*[\[\(\{])([\}\)\}])(.*)[.](.*)$'
Replace: '\1\4\2\3'

You can insert all the row info by selecting and copying the info above with your mouse (in fact you can just block copy this entire posting) , then go to the PFrank window and click on the window to select it.; then press CTL-F2; all the above row info will be inserted at the top of the row.

The way the comand works is to temporarily move the text between brackets to the end of the name as an extension, use the lower case command on the extension, and then move the temporary extension back between the brackets.

Give that a try! It should work if the brackets are anywhere in the name. One limitation is that this will only work for one set of brackets.

btw - the 'text' positioning parameter in the pre-defined command panel is raw text; it is not interpreted as a regex.

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



Joined: 19 Apr 2008
Posts: 6

PostPosted: Sun Apr 20, 2008 1:42 am    Post subject: Reply with quote

Well, that is really cool. It works brilliantly, except when there are two or more sets of () brackets in the same title. When that happens it ignores the first set and only lower cases the last set. Unfortunately, there are a lot of titles with two or more sets of () brackets.

Any ideas?

Edit: sorry to go off topic but how do I enable the caps exclusions that are set up in the options? I've added a few entries that I would like to exclude to the list under Pre Defined Command/ Change Case/ Force Case (middle words) but it doesn't seem to be having any effect on the titles that I am selecting to rename.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sun Apr 20, 2008 3:06 am    Post subject: Reply with quote

1)
Here is a modified version of what I gave you before.

Row: 1
Search: '^(.*[\[\(\{])(.*?[A-Z].*?)([\}\)\}])(.*)$'
Replace: '\1\3\4.\2'
Row: 2
Search:
Replace: '*Lower Case in*Extension*'
Row: 3
Search: '^(.*[\[\(\{])([\}\)\}])(.*)[.](.*)$'
Replace: '\1\4\2\3'


Save or delete what you already have and insert the above using the ctrl-F2 trick. Then repeat the 3 rows for as many times you expect to see a set of brackets in a name (ie. just press ctrl-F2 for each time you want the 3 rows repeated).
The sets of of brackets will have their cases lowered starting from the end set and working toward the start.
The only problem with this is that if you use the case exceptions to force an upper case letter between the brackets, then no more sets of brackets before that will have their case lowered (the reason is that the first search string is triggered by an upper case letter that exists between a set of brackets).
However, If there are not too many case exceptions, then you could just add some more rows to translate the desired text to upper case.

eg. if you want to preserve the word CD in brackets and it is converted to lower case by the 3 row combo above, then you could do the following in the last row (I left the example below as row 1 so you can copy and paste using ctrl-f2):

Row: 1
Search: '(?i)^(.*[\[\(\{].*?) cd (.*?)([\}\)\}].*)$'
Replace: '\1 CD \2\3'

the above will find the first instance of ' cd ' between a set of brackets and replace with ' CD '
This will only work on one instance. If there are multiple instances you will have to repeat the row.

The overall solution is brute force but it should work.

2)
The problem you are having with Case exclusions might be because the option is not enabled. This is done in the 'Change Case' panel located above the 'Force Case (All Words)' panel.

Hope that helps!

Peter.



.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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