shawn Posted May 30, 2010 Report Share Posted May 30, 2010 (edited) Per a discussion from here: http://ketarin.canneverbe.com/forum/viewtopic.php?id=150 I'd really find it useful to be able to perform mass replacements on a variable by passing in an array of "find" and an array of "replace" values. This would work something like this: {myvar:arrayreplace:,:Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec:01,02,03,04,05,06,07,08,09,10,11,12} Where "arrayreplace" is the function name, "," is the delimiter, "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec" is the find array, and "01,02,03,04,05,06,07,08,09,10,11,12" is the replacement array. {myvar:arrayreplace:delimiter:findarray:replacearray} Pushing that against the following values would yield these respective results: 2010-May-08 = 2010-05-08 Dec 11, 2004 = 12 11, 2004 I hate June bugs = I hate 06e bugs Here's another place it would come in handy: {myvar:arrayreplace:|:, Build| Build | part | beta | b:.|.|.|.|-} This would convert: Picasa 3.6, Build 3622 = Picasa 3.6.3622 Audacity 1.3 beta 22 = Audacity 1.3.22 MyApp 2.9 b4 = MyApp 2.9-4 Edited May 30, 2010 by shawn Link to comment Share on other sites More sharing options...
josh Posted May 31, 2010 Report Share Posted May 31, 2010 hi have u tried regexreplace? Link to comment Share on other sites More sharing options...
shawn Posted June 13, 2010 Author Report Share Posted June 13, 2010 To my knowledge, regexreplace provides several search strings, but only one *replacement* string. Am I misunderstanding it's operation? I don't see how it could be used to replace the month *name* with it's numeric equivalent in a single operation. Link to comment Share on other sites More sharing options...
floele Posted July 8, 2010 Report Share Posted July 8, 2010 Seems interesting, will consider that. Link to comment Share on other sites More sharing options...
josh Posted July 10, 2010 Report Share Posted July 10, 2010 Ya interesting indeed looks like u got it Thanks! Link to comment Share on other sites More sharing options...
shawn Posted July 13, 2010 Author Report Share Posted July 13, 2010 AWESOME! I can't wait 'til tomorrow when I get to find and then rewrite a half dozen searches. This is going to save me so much time and variables. Link to comment Share on other sites More sharing options...
CybTekSol Posted September 20, 2010 Report Share Posted September 20, 2010 This is going to enable me to SIMPLIFY my template collection!!! Simpler is ALWAYS better!!! BTW, for Ketarin users that have not used this added function, it was actually named 'multireplace' and from Shawn's example above it would be: {version:multireplace:|:, Build| Build | part | beta | b:.|.|.|.|-} which is similar to what I am going to use to simplify my version regex scrapes in my template collection. This will allow me to eradicate Beta, Build, spaces, - , commas, _, etc. from app versions in one shot!! YEAH!! Link to comment Share on other sites More sharing options...
floele Posted September 21, 2010 Report Share Posted September 21, 2010 This has already been implemented btw. Link to comment Share on other sites More sharing options...
CybTekSol Posted September 21, 2010 Report Share Posted September 21, 2010 Yes indeed, I have been using it for days now and it works beautifully Flo! Thanks... as always! Link to comment Share on other sites More sharing options...
shawn Posted September 26, 2010 Author Report Share Posted September 26, 2010 Just an aside, in most cases in your example: {version:multireplace:|:, Build| Build | part | beta | b:.|.|.|.|-} ...you'd be better off using this: {version:regexreplace:[^\d\.]+:.} That's the most effective means if you KNOW that legitimate version numbers for a job should always include only numbers and dots. Link to comment Share on other sites More sharing options...
CybTekSol Posted September 26, 2010 Report Share Posted September 26, 2010 I have a significant number of apps (60+) with other than numbers and dots so I chose not to go that route for now. Link to comment Share on other sites More sharing options...
shelichrg Posted April 5, 2011 Report Share Posted April 5, 2011 Is there a way for it to be used as a global variable instead of having to put the function in each app? Maybe I'm doing it wrong but when I try to use it as a global variable I get a 404 error, for example, the app I'm downloading is xmedia-recode. I get "xmedia recode The remote server returned an error: (404) Not Found. (http://www.xmedia-recode.de/download/XMediaRecode{version:regexreplace:[/.]+:}_setup.exe)" where the expression would be the version number. I hope that makes sense. Link to comment Share on other sites More sharing options...
shawn Posted April 5, 2011 Author Report Share Posted April 5, 2011 Not as a "global" variable, but you can use it within another variable to rely on the first. Just create a new variable (+), name it (like "newversion"), click "textual content" and then enter your parsing rules, such as: {version:regexreplace:[/.]+:} This works perfectly, as long as the variable "version" has been defined. It will automatically be parsed first so the new variable ("newversion") can be correctly assigned. Link to comment Share on other sites More sharing options...
shelichrg Posted April 6, 2011 Report Share Posted April 6, 2011 Thanks Shawn, it does work perfectly when used as a new variable with the textual content. I was just wondering if I was doing something wrong with the global variable. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now