Alternate constructor that uses a variable name pattern that permits variable names with alphanumerics and underscore.
Alternate constructor that uses a variable name pattern that permits variable names with alphanumerics and underscore.
A function that takes a variable name as a parameter
and returns an Option[String]
value for the
variable, or None
if there is no value
(Map[String, String].get()
, for instance).
true
for a "safe" template that just
substitutes a blank string for an unknown variable,
false
for one that throws an exception.
A function that takes a variable name as a parameter
and returns an Option[String]
value for the
variable, or None
if there is no value
(Map[String, String].get()
, for instance).
Regular expression pattern to match a variable name, as a string (not a Regex). For example: "[a-zA-Z0-9_]+"
true
for a "safe" template that just substitutes
a blank string for an unknown variable, false
for one that throws an exception.
Parse the location of the first variable in string.
Parse the location of the first variable in string.
the string
an Option[Variable]
, specifying the variable's
location; or None
if not found
Replace all variable references in the given string.
Replace all variable references in the given string. Variable references are recognized per the regular expression passed to the constructor. If a referenced variable is not found in the resolver, this method either:
- throws a VariableNotFoundException
(if safe
is
false
), or
- substitutes an empty string (if safe
is true
)
Recursive references are supported (but beware of infinite recursion).
the string in which to replace variable references
Right(substitutedValue)
or Left(error)
A string template that uses the cmd Windows.exe syntax
%varname%
for variable references. A variable's name may consist of alphanumerics and underscores. To include a literal "%" in a string, use two in a row ("%%").