View previous topic :: View next topic |
Author |
Message |
RR
Joined: 11 Mar 2007 Posts: 50 Location: India
|
Posted: Wed May 02, 2007 5:20 pm Post subject: (?<=\D)\.|\.(?=\D) for Files & Folders |
|
|
When I tried to rename a folder named:
Regular.Expression.For.Windows
using this regex
(?<=\D)\.|\.(?=\D) :: (replace with a 'space')
the "Detailed Information (Sortable Mode)" window showed a blank, with
the status bar showing NO CHANGED FILES TO DISPLAY.
What could be wrong? My intention was to rename this folder to
Regular Expression For Windows
I made sure that the 'View > Options > Renaming Type' is set to 'Folders'.
Then again, trying to rename
Regular.Expression.For.Windows.txt
using the same regex line (set to 'Files') brings this up:
Regular Expression For Windows txt
My problem now is: how do I leave the dot immediately preceding the
extension intact? Under the "Pre-Defined Command" the "Prefix" option
was selected. |
|
Back to top |
|
 |
admin Site Admin
Joined: 09 Mar 2007 Posts: 448 Location: Canada
|
Posted: Thu May 03, 2007 4:52 am Post subject: |
|
|
I tried your regex on a folder called Regular.Expression.For.Windows and it worked fine.
My guess would be that either you are trying to rename the current folder (which is not allowed) or you might have something in your name filter which prevents your folder from being scanned. eg. if you have *.mp3 in the name filter then you would never scan the Regular.Expression.For.Windows file.
Although your regex works it doesn't seem to make much sense. It almost looks like you are trying to used named groups.
A simpler expression that does the same thing would be to search for \. and replace with blank.
The 'prefix' field for pre-defined commands is not used for regex's; it is only used for pre-defined commands that you insert into the custom list.
If you want to restrict the regex's to the prefix you have to use a PFrank extension to the flags feature. The flag you want is 'E' which means to exlude the extension.
Use it in the custom renaming list as follows (don't include the single quotes):
Row: 1
Search: '(?E)\.'
Replace: ' '
This will result in periods being replaced with blanks in the file/folder name prefixes. |
|
Back to top |
|
 |
RR
Joined: 11 Mar 2007 Posts: 50 Location: India
|
Posted: Fri May 04, 2007 5:52 pm Post subject: |
|
|
Darn right! It's the "trying to rename the current folder (which is not allowed)" that'd botched things up! I shoulda known this by now! Dragged the 'faulty' folder inside another and then it works! Great wizardry!
Now, I'd like to ask: why not make PFrank to rename current folders? This function, I believe would speed up the processing of things.
About the regex '(?<=\D)\.|\.(?=\D)'. You sure hit the point by using '\.' replaced with a space. Guess I'm somewhat regex-drunk (I'm still trying to learn the tricks). I retain this expression for renaming files containing digits, mostly version numbers. |
|
Back to top |
|
 |
|