Use :- format.

This commit is contained in:
Dave Fisher 2024-09-11 12:20:02 -07:00
parent 8b6a348ed9
commit 1bceb00dac
2 changed files with 2 additions and 2 deletions

View File

@ -217,7 +217,7 @@ public class NBEnvironment {
* @return The interpolated value, after substitutions, or null if any lookup failed
*/
public Optional<String> interpolate(String word, Map<String,String> supplemental) {
Pattern envpattern = Pattern.compile("\\$(?<env1>[a-zA-Z_][A-Za-z0-9_.]+)|\\$\\{(?<env2>[a-zA-Z_][A-Za-z0-9_.]*)(:(?<default>[a-zA-Z0-9_./\\- ]+))?\\}");
Pattern envpattern = Pattern.compile("\\$(?<env1>[a-zA-Z_][A-Za-z0-9_.]+)|\\$\\{(?<env2>[a-zA-Z_][A-Za-z0-9_.]*)(:\\-(?<default>[a-zA-Z0-9_./\\- ]+))?\\}");
Matcher matcher = envpattern.matcher(word);
StringBuilder sb = new StringBuilder();
while (matcher.find()) {

View File

@ -1 +1 @@
- My ${MISSING_ENV_VAR:default value} environment
- My ${MISSING_ENV_VAR:-default value} environment