#1 : 20/08-14 17:07 David
Posts: 64
|
Can I use multiple replacement strings in a single replace method
For example replacing Volume 1 vol. 1 vol 1 with v\1 but placing the 3 examples in a single text to be replaced input box In other words is there a character I can use to separate the three strings so AR will acknowledge all 3 of them. Thanks |
#2 : 05/09-14 12:27 Stefan
Posts: 274
|
Reply to #1:
You can do that by utilizing RegEx and a non-capturing OR group (a|b|c|d): FROM: Example 1 Text vol. 1 Example 2 Text.ext Example 2 Text vol 1 Example 3 Text.ext Example 3 Text Volume 1 Example 1 Text.ext Example 4 Text vol. 13 Example 2 Text.ext Example 5 Text vol 123 Example 3 Text.ext Example 6 Text Volume 4321 Example 1 Text.ext Example 7 Text vol. Example 2 Text.ext Example 8 Text vol Example 3 Text.ext Example 9 Text Volume Example 1 Text.ext TO: Example 1 Text v1 Example 2 Text.ext Example 2 Text v1 Example 3 Text.ext Example 3 Text v1 Example 1 Text.ext Example 4 Text v13 Example 2 Text.ext Example 5 Text v123 Example 3 Text.ext Example 6 Text v4321 Example 1 Text.ext Example 7 Text vol. Example 2 Text.ext Example 8 Text vol Example 3 Text.ext Example 9 Text Volume Example 1 Text.ext Use: Replace Method (http://www.advancedrenamer.com/user_guide/metho d_replace) Find: ^(.+)(?:Volume |vol. |vol )(\d+)(.+)$ Repl: $1v$2$3 [X] Use regular expressions Or with a capturing, but later on not used, OR group Find: ^(.+)(Volume |vol. |vol )(\d+)(.+)$ Repl: $1v$3$4 EDIT Remove to much $4 and $5 tokens. Because I can't count right, there are only 4 groups, not five ;-) |
#3 : 06/09-14 11:33 David
Posts: 64
|
Reply to #2:
Stefan Man, you SERIOUSLY ROCK Both of the responses you just provided worked perfectly. I have been using many methods to accomplish the same things but your way is just SOOOOOOO much more efficient. Thanks VERY MUCH. I do have one addition situation that comes up quite a bit and I'm not sure if the same method can be used what will happen is sometimes there are brackets around the volume specified ie: (v1) (volume 1) (vol. 1) (vol 1) and sometimes there are other characters that I would prefer to eliminate as well such as commas or hyphens before or after the volume. ie: - (v1) - or v1 - blah blah.ext - volume 1 blah blah.ext how can i specify to get rid of these characters ^(.+)(?:Volume |vol. |vol |vol)(\d+)(.+)$ $1v$2$3$4 Can you tell me specifically what all of the components of this expression do exactly so I can start to create my own and not be bothering you with many questions. smile For example what does the ? do in the expression And what exactly does (\d+) do. And (.+) And does the $ specify to AR to stop searching the filename once it finds the expression specified between ^ and $ thereby ignoring the rest of the filename? I notice you have (.+) at the beginning and the end of the expression what does this do exactly Also what is the difference between using the $ in the Replace With field vs using / in the Replace Field. When should I use one or the other. I really appreciate your skill with this app. Tell me are you the developer because I think all of the help I've gotten to my questions so far are from you? Cheers. |
#4 : 06/09-14 11:45 David
Posts: 64
|
Reply to #2:
So I've got another one for you. The titles I am working with have dates in numerous formats but I would like them all to resolve to the format (yyyy-mm) The date starts in many formats ie: mm-yyyy mm yyyy yyyy mm Jan 15, 2014 15 January 2014 among other formats. I would like to get rid of all the text dates and have them converted to digit dates in the specified format instead. Is there a better, more efficient way to do that? Sometimes there are year ranges in the format yyyy-yyyy in the same list of files and I want the method which will create the aforementioned format to not interfere with these dates. Right now I am using about 35 different methods (maybe more) to accomplish this but If there is a way that I can more efficiently do it like the volume resolution method you showed me I would absolutely love that. Right now some of the batch methods I am using have upwards of 300 methods in them so it takes a while to load if I want to load a different group of methods because there are so many methods in them even though I am using a SSD for my OS and the batches are also stored on a SSD. cheers. |
#5 : 06/09-14 11:57 Stefan
Posts: 274
|
Reply to #4:
Such work can be better accomplished with a scripting language. Try Advanced Renamers' JavaScript rule. Therefore you have to develop some rules in English words what's to do: - search for x and do y - but not if a is like b - ... With that info you can try to write (or ask for) a script. There is already a script somewhere in the forum to change '01' to 'Jan' (or was it the other way around?) |
#6 : 30/01-15 21:16 David
Posts: 64
|
Reply to #5:
I would like to be able to convert all the following formats into the form "## (Of ##)" and I would like to be able to do it all in the same replace method if possible. Right now I am accomplishing this end through the use of 21 separate replace methods. ### (Of ###) ### (Of ##) ### (Of #) ### (Of##) - ## (Of ##) # (Of ##) # (Of #) #[of#] # Of ### ### Of ### ### Of ## ## Of ## ## Of ### # Of # # Of ## (# Of #) (#of#) #of# ##of## ##of# ### (of#) I also have other similar tasks where it would be VERY useful to be able to set multiple criteria in the same replace method. So is there a character I can use to separate multiple criteria when the "Use regular expressions" box is checked so that AR will be able to see them. Thanks |