#1 : 01/10-17 01:24
Steven Roy Supeene
I have a string title (A - T - N) where the A is the artist.
Some of them are 'last name. first name' and I want to change them to 'first name last name).
I've tried:- swap; seperator , This moved the last name to the end of the entire string
also :- replace; text to be replaced (.+), (.+); replace with \2 \1 This moved the last name to the beginning of the third element.
How do I do it properly?
#2 : 01/10-17 02:57
Reply to #1:
1. Copy and paste the following into Notepad and save as Swap_Name.aren
(Note: make sure it doesn't end in .txt, it must end in .aren)
2. Double-click on this new file and it will open as a preset in Advanced Renamer.
3. You can save to your presets folder if required for future work. Add your files from there.
application=Advanced Renamer 3.78
method0000=methodname:"replace"; active:"1"; replace:"(.*?) (.*?) (.*)"; replacewith:"\2 \1 \3"; casesensitive:"0"; regularexpressions:"1"; applyto:"name"; occurrence:"0";
#3 : 21/02-18 06:17
Reply to #2: This is brilliant and worked great for me. How do I figure out what this is doing, so I can hopefully do this kind of thing in the future?
#4 : 21/02-18 10:09
Reply to #3:
This is best seen in the AR GUI, and once you’re happy, the method (or methods) can then be saved.
OK, given a file of the form AAAAA 123 AAA AAA - BBB 345 BBBB B - CCC 678 CCC CC.txt, you want to swap the Cs with the As to give CCC 678 CCC CC - BBB BBBB B - AAAAA 123 AAA AAA.txt. The separators are the “-“ characters.
Text to be replaced : (.*)-(.*)-(.*)
Replace with: \3 -\2- \1
Case sensitive: un-ticked
Use regular expressions: ticked
Apply to: Name
See https://www.advancedrenamer.com/user_guide/regul ar_expresions
The "." is a metacharacter which represent any character. The "*" is a metacharacter which matches a previous character or metacharacter 0 or more times
You should be able to make out what is happening. Those brackets are pattern-matching, finding groups of characters separated specifically by a “-“. Each group has a numerical number associated with it (a subpattern value) which is used in the pattern-based replace.
Note; be careful with the separators used in the Replace with (\3 -\2- \1), as my example used spaces in the "groups". The previous post used (.*?), where the ? is a metacharacter that matches a previous character or metacharacter 0 or 1 times, so will find the space before the separator (I think!).
The great thing about the AR GUI is you can inspect the new name as you change the Method values accordingly.
Re-arrange/edit to suit what you need.
By the way, in AR method window (on the left), hit the ? button for direct help. Hit the </> for more info.
21/02-18 10:09 - edited 21/02-18 10:40