Jump to content
Ketarin forum

function: prepend


shawn
 Share

Recommended Posts

Feature request for a function that only prepends the text if a certain condition is met.

 

For example, the parsed download for LicenseCrawler now includes the full domain. I imagine this will change shortly and return to just the relative path name. Instead of updating my app profile, I'd like to be able to prepend the protocol and domain name ONLY when a protocol and domain name aren't there.

 

In context I imagine it would go something like this, the logic being presented as, "if '//' isn't included in the variable value, prepend the value with x". Note that since multiple instances of ":" are expected (especially for prepended text) everything after the first separator should be ignored.

 

 

{download:prepend://:http://example.com}
Link to comment
Share on other sites

No. The regexreplace example you've provided would replace an instance of // with the protocol and domain if it appears at the beginning of a string (//path/file.ext), but it would not replace anything if the text "//" doesn't appear.

Link to comment
Share on other sites

  • 1 year later...

An update after re-reading this topic...

 

This function call:

 

    {download:regexreplace:^(?!http\://example.com)/{0,2}(\w):http\://example.com/\1}

 

changes the download values:

 

    //path/file.ext

    /relativepath
    relativepath
    http://example.com/relativepath
 

to:

 

    http://example.com/relativepath

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.