Move String

Comments & Suggestions, if you want a new feature suggest it here
Post Reply
nasair
Posts: 12
Joined: 2014-04-01 14:51:12

Move String

Post 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
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post 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).
nasair
Posts: 12
Joined: 2014-04-01 14:51:12

Yes please

Post by nasair »

I have never been able to do variable expresions with success in Ant Renamer, please give me an example.
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

To give you an example, I would need to have an example of which kind of change you need to to
nasair
Posts: 12
Joined: 2014-04-01 14:51:12

examples

Post 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 ","
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post 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
nasair
Posts: 12
Joined: 2014-04-01 14:51:12

Awesome

Post 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!
Post Reply