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 

Matching combination of expressions

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



Joined: 09 Mar 2007
Posts: 16
Location: BR

PostPosted: Wed Nov 21, 2007 3:36 pm    Post subject: Matching combination of expressions Reply with quote

Hi Peter, how can I make a regex to match combinations?
Here's what I want to do:
I have the terms "USA", "Asia", "Europe" and "Africa" and I want to be able to match "USA, Africa", "Asia, USA", "Europe, Africa, Asia", "Africa" and any other possible combinations with 1, 2, 3 or 4 terms separated by a comma.
Is it possible?

Thanks a lot!
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 446
Location: Canada

PostPosted: Wed Nov 21, 2007 4:51 pm    Post subject: Reply with quote

You can't define components and then match their combinations using a regular expression. This could be done using a user-defined command (plugin).

You can, however, define components in other ways and manipulate them.
For example could define the continents in the force case tables and always force them to be a certain case. Or you could look for the continents and delete them or repositionb them individually using regular expressions.

What are you trying to do? Some sample before and after names would be useful to determine the best way to handle the renaming.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ssjkakaroto



Joined: 09 Mar 2007
Posts: 16
Location: BR

PostPosted: Wed Nov 21, 2007 7:51 pm    Post subject: Reply with quote

I want to remove them from the file name, the file names are completly different from one another but they all have the continents tag, for example:
"File 1 (USA).ext" -> "File 1.ext"
"Another name (Europe, Asia).ext" -> "Another name.ext"
"Yet another file (USA, Asia, Europe) (more random data).ext" -> "Yet another file (more random data).ext"

I know I can just replace each continent with nothing and them clean the leftovers but I just wanted to know if there was a more "refined" way using regex Wink
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 446
Location: Canada

PostPosted: Thu Nov 22, 2007 4:08 am    Post subject: Reply with quote

Thought about this some more.
Try this in the search column (leave the replace column blank):

[(]((Asia|USA|Europe|Africa)[, ]*)+[)]


I guess regex's can be used for combinations afterall Wink

Cheers,

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



Joined: 09 Mar 2007
Posts: 16
Location: BR

PostPosted: Thu Nov 22, 2007 6:08 pm    Post subject: Reply with quote

Wow, thanks a lot Peter! Very Happy
Just out of curiosity, does it make any difference if I use \( and \) instead of [(] and [)]?
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 446
Location: Canada

PostPosted: Fri Nov 23, 2007 7:40 am    Post subject: Reply with quote

There is no difference. I just used the square brackets since it made the overall expression look clearer.

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