Package org.aksw.commons.util.string
Class Envsubst
java.lang.Object
org.aksw.commons.util.string.Envsubst
A basic 'envsubst' implementation.
Just uses regex matching for substituting placeholders in a string.
Does not precompile templates - we may want to switch to a fully fledged template engine for that.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternRegex for matching strings such as '${varname}' variable names cannot include the '}' symbol -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
PLACEHOLDER_PATTERN
Regex for matching strings such as '${varname}' variable names cannot include the '}' symbol
-
-
Constructor Details
-
Envsubst
public Envsubst()
-
-
Method Details
-
envsubst
Perform substitution of placeholders of form "${name}"- Parameters:
input- A string in which to replace placeholder patternsgetReplacement- Function that receives the variable name of a match and can return a substitution string. A result of null leaves the placeholder unchanged in order to allow for future substitution.- Returns:
-