netBios Posted April 18, 2014 Report Share Posted April 18, 2014 Hi all, I am new to Ketarin in using functions on variables. How can I edit a variable that has no points in the version string I grab on the download page? Example: v7460 (this is the value of my variable) I want: v7.4.6.0 I tried some things using "multireplace" without success... Thanks for your help! Link to comment Share on other sites More sharing options...
Electrosokk Posted April 19, 2014 Report Share Posted April 19, 2014 You need to use the regexreplace function to add the missing points: {version:regexreplace:(\w\d)(\d)(\d)(\d):$1.$2.$3.$4} Link to comment Share on other sites More sharing options...
netBios Posted April 19, 2014 Author Report Share Posted April 19, 2014 Hi Electrosokk, thanks alot for your help. Your example works! Is it possible to read the lenght of the string first, to avoid errors if the version switches a lenght of 5 digits? Link to comment Share on other sites More sharing options...
shawn Posted April 19, 2014 Report Share Posted April 19, 2014 In that scenario, assuming that it'll be the first value that's extended, you can do this: {version:regexreplace:(\w\d)(\d+)(\d)(\d)$:$1.$2.$3.$4} That'll allow the first digit to expand to as long as possible while requiring three more unique digits afterwards. v12345 would convert to v12.3.4.5 and v123456789 would convert to v123456.7.8.9 Link to comment Share on other sites More sharing options...
netBios Posted May 14, 2014 Author Report Share Posted May 14, 2014 hi shawn, thank you for your example. I am using this for the affected downloads. 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