Jump to content
Ketarin forum

Assistance with {variable:multireplace}


Recommended Posts

I'm rather curious as to how we can replace something with the : symbol, I don't see a way of making it treat : as text and not as an operator.

 

Only two of my links are given as %3A which is the : symbol, I want to replace %3A with : obviously. Also has %2F which is the /

 

{download:multireplace:,:%2F,%3A:/,:}

 

That works for the / but the %3A is just replaced with nothing so i'm not sure how to get it. Any pointers?

Link to post
Share on other sites

Were the first things I tried, didn't work.

 

http%3A%2F%2Fdownload.portableapps.com%2Fportableapps%2Ffoxitreaderportable%2FFoxitReaderPortable_4.1.1.paf.exe

 

That is what i'm trying to convert, as I said it is for a link. I can obviously just skip the http: part and put that in manually but I think it would be good for ketarin to be able to have an operator that says 'treat this as text' like the \ for regex

Link to post
Share on other sites

I've never been in that position, but as a rule, you use the backslash to "escape" characters. So something like this ought to work:

{download:replace:%3A%2F%2F:\://}

 

However, it would be so much easier to simply extract only that portion you needed in the first place, and prepend "http://" in the download box:

(download\.portableapps\.com%2Fportableapps%2Ffoxitreaderportable%2FFoxitReaderPortable_[\d\.]+paf\.exe)

Link to post
Share on other sites
  • 3 months later...

Got another one that's bugging me, i'm just trying to get the appname to be returned without any illegal windows characters

 

{appname:multireplace:,:/,?,<,>,\,/:,*,”:}

 

Just make Ketarin crash, but I assume i'm close enough to being correct. Can anyone give me that final thing i'm obviously missing?

Link to post
Share on other sites

This should work for you:

{appname:multireplace:,\:/,?,<,>,\,/:,*,”:}

 

However, as a rule, whitelisting characters is far safer than blacklisting. Thus, this should be more reliable:

{appname:regexreplace:([^a-zA-Z0-9\_]+):-}

 

That'll replace any non-alphanumeric or underscore sequences with a single dash. So something like "Title | my trip to mars: fun times!" will become "Title-my-trip-to-mars-fun-times-"

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • 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.