#1 2010-03-24 14:03

ozzii
Senior Member
Registered: 2007-07-04
Posts: 101

Striping from vs/feat/ft till last dash

I made these rules:

3) RegEx: Replace expression "(.*)( vs.*\-)(.*)" with "$1-$3" (skip extension)
4) RegEx: Replace expression "(.*)( feat.*\-)(.*)" with "$1-$3" (skip extension)
5) RegEx: Replace expression "(.*)( ft\..*\-)(.*)" with "$1-$3" (skip extension)

I have:
foo vs bar-result.mp3
foo feat bar-result.mp3
foo ft. bar-result.mp3

And the result required is:
foo-result.mp3

Is it OK? Is there a better way (maybe with rearrange)?
To resum I would like to truncate from "vs|feat|ft." until the last "-"

Last edited by ozzii (2010-03-24 14:03)


_________________
Do, or do not. There is no 'try.'" --  Jedi Master Yoda

Offline

#2 2010-03-24 14:23

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,379

Re: Striping from vs/feat/ft till last dash

They seem ok, although it would be safer to check for a space after "vs|feat|ft." in the pattern, so you can elminate the case when these are parts of some words, for example: "foo vsop bar-result.mp3" -> "foo-result.mp3".

Alternatively, you can use Delete rule, form delimiter to delimiter. It should work faster than RegEx but it will work only with the first found delimiter, so you can replace last delimiter with some unusual character and then use it in Delete rule.

Offline

#3 2010-03-24 15:57

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Striping from vs/feat/ft till last dash

Hi ozzii, just some thought:

- you don't need to ()-group what you don't need in replacement,
so "(.*) vs.*\-(.*)" with "$1-$2" should work too.

- you don't have to escape the '-' dash into ()-groups,
only between '[' and ']' and there only if he is not on first or last position
so "(.*) vs.*-(.*)" with "$1-$2" should work too.



- you can use (this|or|that) "OR"-construct like
so "(.*)\s(vs|feat|ft.)\s.*-(.*)" with "$1-$3" should work too.

Explanation:
(.*) ==> match null-or-more of any sign till
\s ==> an space followed by
(vs|feat|ft.) ==> vs OR feat OR ft., followed by
\s ==> an space followed by
.*-  ==> null-or-more of any sign till an dash, followed by
(.*) ==> null-or-more of any sign till the end

HTH? smile

Last edited by Stefan (2010-03-24 16:04)


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#4 2010-03-24 19:54

ozzii
Senior Member
Registered: 2007-07-04
Posts: 101

Re: Striping from vs/feat/ft till last dash

Thanks for the answer (both of you of course...)
I will test the 2 possibility.
Thanks again


_________________
Do, or do not. There is no 'try.'" --  Jedi Master Yoda

Offline

Board footer

Powered by FluxBB