Jump to content
Ketarin forum

(*,?) with replace


FranciscoR
 Share

Recommended Posts

Flo, what about implementing wildcards (*,?) to use with replace function ?

 

--------------------------------------

 

* = matches up with any combination of allowable characters

 

? = matches up with any single allowable character

 

\* OR \? = matches a literal * OR a literal ?

 

--------------------------------------

 

This way I could use something like:

 

*.exe

 

ab*.zip

 

*.*

 

?.doc

 

ab?.txt

 

*ab?.do?

 

 

This could be most handy. =D

Link to comment
Share on other sites

1. I can use

 

{variable:regex:(.*?)\.exe:0}

 

with

 

{variable1:replace:ABCDE.exe:KKK_ABCDE.exe}

 

IF I know what ABCDE will be. Otherwise this won't work.

 

Then again, if I had

 

{variable:replace:*.exe:KKK_*.exe}

 

This will be done in a breeze.

 

2. Unless you're talking of regex named group substitutions... ? =)

Edited by FranciscoR
Link to comment
Share on other sites

You want a regex-replace.

 

That will do to. =)

 

If I had some date in European style and I need to change to US I would use

 

{variable:regex:([0-9]{1,2\}).([0-9]{1,2\}).([0-9]{4\}):$3-$2-$1)

 

or, something like

 

{variable:regex:([0-9]{1,2\}).([0-9]{1,2\}).([0-9]{2\})([0-9]{2\}):$4-$2-$1)

 

or, for above example

 

{variable:regex:.*?\.exe:KKK_.*?\.exe}

Link to comment
Share on other sites

MAN... I'm speachless !!! =D

 

 

 

26-02-2009 21:11:24: Update started with 1 application(s)

26-02-2009 21:11:24: Test: Replacing {app} in '{app:split:=:5}' with 'http://www.versiontracker.com/php/dlpage.php?id=9679&db=win&pid=10008952&kind=&lnk=http%3A%2F%2Fwww.jam-software.com%2Ftreesize%2FTreeSizeProfessional-Demo.exe'

26-02-2009 21:11:24: Test: Replacing {app2} in '{app2:replace:%2F:/}' with 'http%3A%2F%2Fwww.jam-software.com%2Ftreesize%2FTreeSizeProfessional-Demo.exe'

26-02-2009 21:11:24: Test: Replacing {app3} in '{app3:toupper}' with 'http%3A//www.jam-software.com/treesize/TreeSizeProfessional-Demo.exe'

26-02-2009 21:11:24: Test: Replacing {app4} in '{app4:tolower}' with 'HTTP%3A//WWW.JAM-SOFTWARE.COM/TREESIZE/TREESIZEPROFESSIONAL-DEMO.EXE'

26-02-2009 21:11:24: Test: Replacing {app5} in '{app5:replace:http%3a:http\\:}' with 'http%3a//www.jam-software.com/treesize/treesizeprofessional-demo.exe'

26-02-2009 21:11:24: Test: Using referer: (none)

26-02-2009 21:11:28: Test: Server source file: /treesize/treesizeprofessional-demo.exe

26-02-2009 21:11:28: Test: Replacing {test1} in '{target}\Test\Test_{test1:regexreplace:([0-9]{2\})\.([0-9]{2\})\.([0-9]{4\}):$3-$2-$1}_{test2}.exe' with '26.02.2009'

26-02-2009 21:11:28: Test: Replacing {app} in '{app:split:=:1}' with 'http://www.versiontracker.com/php/dlpage.php?id=9679&db=win&pid=10008952&kind=&lnk=http%3A%2F%2Fwww.jam-software.com%2Ftreesize%2FTreeSizeProfessional-Demo.exe'

26-02-2009 21:11:28: Test: Replacing {id} in '{id:regex:(\d{1,4\})(.*?):1}' with '9679&db'

26-02-2009 21:11:28: Test: Replacing {id1} in '{id1:trimend:9}' with '9679'

26-02-2009 21:11:28: Test: Replacing {id2} in '{id2:trimstart:9}' with '967'

26-02-2009 21:11:28: Test: Replacing {id3} in '{id3:replace:67:9679}' with '67'

26-02-2009 21:11:28: Test: Replacing {id4} in 'http://www.versiontracker.com/dyn/moreinfo/win/{id4}' with '9679'

26-02-2009 21:11:32: Test: Replacing {version} in '{version:regexreplace:(\d\.\d\.\d):ABC_$1}' with '5.1.2'

26-02-2009 21:11:32: Test: Replacing {test2} in '{target}\Test\Test_2009-02-26_{test2}.exe' with 'ABC_5.1.2'

26-02-2009 21:11:32: Test: Determined target file name: D:\Programas\Test\Test_2009-02-26_ABC_5.1.2.exe

26-02-2009 21:11:32: Test: Checking if update is required...

26-02-2009 21:11:32: Test: Update required, 'D:\Programas\Test\Test_2009-02-26_ABC_5.1.2.exe' does not yet exist

26-02-2009 21:11:32: Test: Replacing {app} in '{app:split:=:1}' with 'http://www.versiontracker.com/php/dlpage.php?id=9679&db=win&pid=10008952&kind=&lnk=http%3A%2F%2Fwww.jam-software.com%2Ftreesize%2FTreeSizeProfessional-Demo.exe'

26-02-2009 21:11:32: Test: Replacing {id} in '{id:regex:(\d{1,4\})(.*?):1}' with '9679&db'

26-02-2009 21:11:32: Test: Replacing {id1} in '{id1:trimend:9}' with '9679'

26-02-2009 21:11:32: Test: Replacing {id2} in '{id2:trimstart:9}' with '967'

26-02-2009 21:11:32: Test: Replacing {id3} in '{id3:replace:67:9679}' with '67'

26-02-2009 21:11:32: Test: Replacing {id4} in 'http://www.versiontracker.com/dyn/moreinfo/win/{id4}' with '9679'

26-02-2009 21:11:34: Test: Replacing {version} in '{version}' with '5.1.2'

26-02-2009 21:11:34: Update finished

 

 

I already did this twice just to see it working. Thanks a lot Flo, awesome ! ;)

Edited by FranciscoR
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.