View previous topic :: View next topic |
Author |
Message |
Fatbat
Joined: 19 Apr 2008 Posts: 6
|
Posted: Sat Apr 19, 2008 5:24 pm Post subject: lower case between ( ) brackets? |
|
|
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 |
|
 |
admin Site Admin
Joined: 09 Mar 2007 Posts: 448 Location: Canada
|
Posted: Sat Apr 19, 2008 6:15 pm Post subject: |
|
|
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 |
|
 |
Fatbat
Joined: 19 Apr 2008 Posts: 6
|
Posted: Sat Apr 19, 2008 6:28 pm Post subject: |
|
|
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
Let's assume for now that the bracketed text always appears at the beginning of a file name. |
|
Back to top |
|
 |
admin Site Admin
Joined: 09 Mar 2007 Posts: 448 Location: Canada
|
Posted: Sat Apr 19, 2008 6:53 pm Post subject: |
|
|
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 |
|
 |
Fatbat
Joined: 19 Apr 2008 Posts: 6
|
Posted: Sun Apr 20, 2008 1:42 am Post subject: |
|
|
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 |
|
 |
admin Site Admin
Joined: 09 Mar 2007 Posts: 448 Location: Canada
|
Posted: Sun Apr 20, 2008 3:06 am Post subject: |
|
|
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 |
|
 |
|