shawn Posted April 29, 2015 Report Share Posted April 29, 2015 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 More sharing options...
MAPJe71 Posted April 29, 2015 Report Share Posted April 29, 2015 Couldn't you solve this like so: {download:regexreplace:^//:http\://example.com} Link to comment Share on other sites More sharing options...
shawn Posted April 29, 2015 Author Report Share Posted April 29, 2015 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 More sharing options...
MAPJe71 Posted April 30, 2015 Report Share Posted April 30, 2015 This function call: {download:regexreplace:^(?!http\://example.com)/?(\w):http\://example.com/\1} changes the download values: /relativepath relativepath http://example.com/relativepath to: http://example.com/relativepath Link to comment Share on other sites More sharing options...
MAPJe71 Posted December 3, 2016 Report Share Posted December 3, 2016 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 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