Page 1 of 1

Move String

Posted: 2014-04-01 14:55:34
by nasair
I have used in the past a file renamer that can move the string even with variables. I can't find that one but I do love Ant Renamer more anyways.
Is there any posibility that you'd add variable support to the move string?
Using the String replacement first is a pain if dealing with lots of variables.
Thank you,
Nasair

Posted: 2014-04-01 15:05:59
by antp
For handling variable strings the regular expressions are usually the easiest way.
If you do not know how to write them, I can give you sample ones for what you want to do (with explanations, so you can also modify them).

Yes please

Posted: 2014-04-01 15:59:31
by nasair
I have never been able to do variable expresions with success in Ant Renamer, please give me an example.

Posted: 2014-04-01 16:33:04
by antp
To give you an example, I would need to have an example of which kind of change you need to to

examples

Posted: 2014-04-01 16:51:05
by nasair
Hey, sorry. I missunderstood.
I have three places I would like to do this:
1. move everything from the end to the begning, song 01 - Tina Turner > Tina Turner - song 01
2. Turner, Tina > Tina Turner
3. three one two > one two three
I know I might need to do some value replacement when done to get the finished product but I was hopeing to move things based on being before or after a space " ", dash "-", and comma ","

Posted: 2014-04-01 21:29:41
by antp
That one is easy.
The expression for that would be :

(.+) - (.+)\.(.+)

and the next name :

$2 - $1.$3

. means any character
+ means at least one
between parenthesis = a group (represented by $ + group number in the new name)
\. means just a dot (for the extension) : as a . alone has a special meaning it must be preceded by a backslash when you want an actual dot.

For the second example it would work the same way:

expression = (.+), (.+)\.(.+)

new name = $2, $1.$3

Awesome

Posted: 2014-04-01 21:45:47
by nasair
I didn't really understand the regular expression, I don't completely understand it now, but I have made some use of it. Thank you a bunch!