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 

Regular expression that matches, except

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



Joined: 27 May 2008
Posts: 3

PostPosted: Tue May 27, 2008 2:45 pm    Post subject: Regular expression that matches, except Reply with quote

Hi, This is my first post on this forum. I'm trying to write a multi-line set of rules for file renaming. I got stuck with this particular problem:
I'm using ' - ' as a delimiter between e.g. artist - title, but all other instances of '-' should be removed and replaced by spaces. I've tried to use [^( - )] but have had no success so far. I'm all out of ideas. 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: Wed May 28, 2008 3:47 am    Post subject: Reply with quote

It would be useful to know what distinguishes the dash between the artist/title from the other dashes in the name.

I'll assume that the first dash is the one between the artist/title and that you want to replace all other dashes with spaces. To do this, enter the following info into the custom creator renaming list (don't include the single quotes):

Row: 1
Search: '(?1)-'
Replace: 'xyzzz'
Row: 2
Search: '-'
Replace: ' '
Row: 3
Search: 'xyzzz'
Replace: '-'

The first row is used to convert the first dash to a unique string.
The second row replaces all remaining dashes with spaces.
The third row replaces the unique string from row 1 with a dash.

Hope this helps! IF not, then please provide some specific examples of before/after names.

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



Joined: 27 May 2008
Posts: 3

PostPosted: Wed May 28, 2008 1:25 pm    Post subject: Reply with quote

I'm sorry for being unclear about what I'm looking for.
What distinguishes the delimiter between artist/title is the sequence: space-dash-space.
This mostly occurs just once, but sometimes more, and all instances have to remain unchanged.
ex:
10cc - I'm Not In Love.mp3
Amy Winehouse - BtB 05 - Back to Black.mp3

The other instances of the dash can occur in various combinations, such as --,---, or - - , and many more
ex:
Arid - Life--.mp3 --> Arid - Life.mp3
Beach Boys - Kokomo_- - -.mp3 --> Beach Boys - Kokomo.mp3
David-Gray - 03 - My Oh My.mp3 --> David Gray - 03 - My Oh My.mp3

I was trying to get rid of the unwanted dashes by replacing them with spaces, and after that deal with all the double and triple spaces.

I hope this explains it better. Thanks for your help.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Wed May 28, 2008 4:23 pm    Post subject: Reply with quote

OK. This should do it.
If you want to avoid cutting and pasting every search/replace string below, then you can instead use the mouse to block copy the entire sequence (starting anywhere before 'Row: 1') and then go to the PFrank window, select it, and type ctrl-f2; this will result in the sequence being loaded properly into the top of the custom list.

Row: 1
Search: '[-]{2,9}'
Replace: ' '
Row: 2
Search: '- -'
Replace: ' '
Row: 3
Search: '([^ ])-([^ ])'
Replace: '\1 \2'
Row: 4
Search: '([^ ])-'
Replace: '\1 '
Row: 5
Search: '-([^ ])'
Replace: ' \1'
Row: 6
Search: '_'
Replace: ' '
Row: 7
Search:
Replace: '*Delete All Extra Whitespace in*Prefix*'


The first row takes care of consecutive dashes, the second row takes care of most of the multiple dash sequences that are separated by spaces. Rows 3 to 5 take care of any remaining dash sequences.
Row 6 is used to replace '_' with a space (I assumed that this was required based on your example).
If you have any other questions then let me know.

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



Joined: 27 May 2008
Posts: 3

PostPosted: Thu May 29, 2008 12:40 pm    Post subject: Reply with quote

Thanks Peter, that worked like a charm. Also, an interesting learning experience with regular expressions.
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