All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.siwenyan.si.model.VarExpression Maven / Gradle / Ivy

There is a newer version: 1.25.1.0
Show newest version
package com.github.siwenyan.si.model;

import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class VarExpression {
    public static final Pattern pattern = Pattern.compile("(\\$\\{([^\\{\\}]+)\\})");

    public static Set extractVariableNames(String s) {
        Set variableNameSet = new HashSet();
        Matcher matcher = VarExpression.pattern.matcher(s);
        while (matcher.find()) {
            variableNameSet.add(matcher.group(2));
        }
        return variableNameSet;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy