Jump to content
Ketarin forum

Assistance with {variable:multireplace}


Omniferum
 Share

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 comment
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 comment
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 comment
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 comment
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 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.